添加公司一楼大厅室外,宁夏银川金凤新华联广场场景,添加指引系统
This commit is contained in:
@@ -118,6 +118,8 @@ public class Boss : Enemy
|
||||
endValue = 18f;
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Gansu_Jinchang_Jinchuan_Shijiguangchang_Shiwai)
|
||||
endValue = 0.51f;
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Ningxia_Yinchuan_Jinfeng_XinhualianGuangchang)
|
||||
endValue = 15.75f;
|
||||
if(GameInit.Ins.gamePlace == GamePlace.Shandong_Jining_Shangchang)
|
||||
{
|
||||
transform.DOMove(new Vector3(11.5f,transform.position.y,3.68f), 4).OnComplete(() =>
|
||||
@@ -413,6 +415,21 @@ public class Boss : Enemy
|
||||
Both();
|
||||
});
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Ningxia_Yinchuan_Jinfeng_XinhualianGuangchang)
|
||||
{
|
||||
transform.DOMove(new Vector3(15.09f, 3f, 15.75f), 4).OnComplete(() =>
|
||||
{
|
||||
Both();
|
||||
});
|
||||
}
|
||||
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Company1FloorShiwai)
|
||||
{
|
||||
transform.DOMove(new Vector3(-0.85f, 3f, 22.41f), 4).OnComplete(() =>
|
||||
{
|
||||
Both();
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
@@ -641,6 +641,21 @@ public class DropShip : Enemy
|
||||
_isShow = false;
|
||||
});
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Company1FloorShiwai)
|
||||
{
|
||||
transform.DOMove(new Vector3(1.59f, 5f, 20.24f), 4).OnComplete(() =>
|
||||
{
|
||||
isAttack = true;
|
||||
foreach (var item in tailGas)
|
||||
{
|
||||
item.SetActive(true);
|
||||
}
|
||||
bloodSlider.gameObject.SetActive(true);
|
||||
isShield = false;
|
||||
shieldObj.SetActive(false);
|
||||
_isShow = false;
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
@@ -404,6 +404,20 @@ public class Leviathan : Enemy
|
||||
Both();
|
||||
});
|
||||
}
|
||||
else if (GameInit.Ins.gamePlace == GamePlace.Hebei_Hengshui_Xinji_WandaGuangchang)
|
||||
{
|
||||
transform.DOMove(new Vector3(0.3f, -3.5f, 2.8f), 2).OnComplete(() =>
|
||||
{
|
||||
Both();
|
||||
});
|
||||
}
|
||||
else if (GameInit.Ins.gamePlace == GamePlace.Company1FloorShiwai)
|
||||
{
|
||||
transform.DOMove(new Vector3(-10.91f, 1.5f, 25.15f), 2).OnComplete(() =>
|
||||
{
|
||||
Both();
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
@@ -389,6 +389,20 @@ public class MachineDragon : Enemy
|
||||
Both();
|
||||
});
|
||||
}
|
||||
else if (GameInit.Ins.gamePlace == GamePlace.Ningxia_Yinchuan_Jinfeng_XinhualianGuangchang)
|
||||
{
|
||||
transform.DOMove(new Vector3(5.88f, 0f, -1.08f), 4).OnComplete(() =>
|
||||
{
|
||||
Both();
|
||||
});
|
||||
}
|
||||
else if (GameInit.Ins.gamePlace == GamePlace.Company1FloorShiwai)
|
||||
{
|
||||
transform.DOMove(new Vector3(-4.48f, 0f, 21.35f), 4).OnComplete(() =>
|
||||
{
|
||||
Both();
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using DragonLi.Core;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Unity.Mathematics;
|
||||
using Unity.XR.PXR;
|
||||
using UnityEngine;
|
||||
@@ -18,6 +19,7 @@ public enum GamePlace
|
||||
{
|
||||
// Test = -1,
|
||||
Company1Floor = 0,
|
||||
Company1FloorShiwai = -999,
|
||||
LiaoningAnShan = 1,
|
||||
Liaoning_AnShan_Lishan_Dayuecheng=-1,
|
||||
HangZhouLongHuTianJie = 2,
|
||||
@@ -76,6 +78,8 @@ public enum GamePlace
|
||||
Chongqing_Yuzhong_Hongyadong_Xiakexing=42,
|
||||
Chongqing_Yuzhong_Hongyadong_Xiakexing_shiwan=-42,
|
||||
Chengdu_Shuangliu_ShengfeiXuexiao =43,
|
||||
Hebei_Hengshui_Xinji_WandaGuangchang = 44,
|
||||
Ningxia_Yinchuan_Jinfeng_XinhualianGuangchang = 45,
|
||||
}
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
@@ -154,7 +158,18 @@ public class GameManager : MonoBehaviour
|
||||
[Header("AI角色")]
|
||||
public GameObject aiCharacterPre;//AI角色预制体
|
||||
private GameObject aiCharacter;//AI角色实例
|
||||
|
||||
[Header("指引系统")]
|
||||
public GameObject GuideArrowPre; // 指引箭头预制体
|
||||
private GameObject guideArrowInstance; // 指引箭头实例
|
||||
private GuideArrowPath guideArrowComponent; // 指引箭头组件
|
||||
private bool isGuideArrowActive = false;
|
||||
private Vector3 lastPlayerPosition; // 记录玩家上一次的位置
|
||||
private float updatePathThreshold = 0.5f; // 更新路径的阈值(玩家移动超过这个距离才更新路径)
|
||||
private float updatePathCooldown = 0.3f; // 更新路径的冷却时间
|
||||
private float lastPathUpdateTime = 0f;
|
||||
private Vector3[] lastPathPoints; // 上一次的路径点
|
||||
private bool isPathSmoothed = false;
|
||||
private List<Vector3> smoothedPath = new List<Vector3>();
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
@@ -165,7 +180,8 @@ public class GameManager : MonoBehaviour
|
||||
Ins = this;
|
||||
CreatePlayer();
|
||||
LoginPanel.Show();
|
||||
|
||||
// 新增:初始化指引系统
|
||||
InitializeGuideArrow();
|
||||
#if !UNITY_EDITOR
|
||||
PXR_Enterprise.InitEnterpriseService();
|
||||
PXR_Enterprise.BindEnterpriseService();
|
||||
@@ -174,7 +190,11 @@ public class GameManager : MonoBehaviour
|
||||
CoroutineTaskManager.Instance.WaitSecondTodo(ShowPlayerUI, 1.5f);
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
// 更新指引箭头位置
|
||||
UpdateGuideArrowPosition();
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
@@ -226,6 +246,8 @@ public class GameManager : MonoBehaviour
|
||||
loginInfo.shop = 37;
|
||||
if(GameInit.Ins.gamePlace== GamePlace.Chongqing_Yuzhong_Hongyadong_Xiakexing_shiwan)
|
||||
loginInfo.shop = 42;
|
||||
if(GameInit.Ins.gamePlace== GamePlace.Company1FloorShiwai)
|
||||
loginInfo.shop = 0;
|
||||
#endif
|
||||
//loginInfo.shop = 0;
|
||||
loginInfo.gameId = 5;
|
||||
@@ -333,7 +355,7 @@ public class GameManager : MonoBehaviour
|
||||
//TODO:添加一个玩家进入游戏AI进行游戏介绍,介绍完后,AI自动回到玩家左侧
|
||||
//修改处:创建AI角色
|
||||
CreateAICharacter();
|
||||
|
||||
CleanupGuideArrow();
|
||||
//isGamePlay = true;
|
||||
//CreateBoss();
|
||||
//PlayerUIMessage(0);
|
||||
@@ -614,6 +636,18 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(2f, 0, 2f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Hebei_Hengshui_Xinji_WandaGuangchang)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(0.18f, 0, 5.09f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Ningxia_Yinchuan_Jinfeng_XinhualianGuangchang)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(10.35f, 0, 4.33f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Company1FloorShiwai)
|
||||
{
|
||||
EnergyPump.transform.position = new Vector3(-0.75f, 0, 22.38f);
|
||||
}
|
||||
EnergyPumpTag++;
|
||||
|
||||
EnergyPump.GetComponent<EnergyPump>().Init(EnergyPumpTag);
|
||||
@@ -626,8 +660,10 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public void CreateGameStartPoint()
|
||||
{
|
||||
|
||||
GameStart = true;
|
||||
isGamePlay = false;
|
||||
|
||||
GameObject point = Instantiate(gameStartPointPre);
|
||||
if (GameInit.Ins.gamePlace == GamePlace.LiaoningAnShan)
|
||||
{
|
||||
@@ -637,11 +673,19 @@ public class GameManager : MonoBehaviour
|
||||
{
|
||||
point.transform.position = new Vector3(7.46f, 0, 1.65f);
|
||||
}
|
||||
if (GameInit.Ins.gamePlace == GamePlace.Ningxia_Yinchuan_Jinfeng_XinhualianGuangchang)
|
||||
{
|
||||
point.transform.position = new Vector3(4.15f, 0, 2.3f);
|
||||
}
|
||||
else
|
||||
{
|
||||
point.transform.position = Vector3.zero;
|
||||
point.transform.position = new Vector3(0.27f, 0, 2.84f);
|
||||
}
|
||||
|
||||
|
||||
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
StartGuide();
|
||||
}, 0.5f);
|
||||
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
if (isGamePlay)
|
||||
@@ -881,4 +925,336 @@ public class GameManager : MonoBehaviour
|
||||
Destroy(aiCharacter);
|
||||
}
|
||||
}
|
||||
#region 指引系统
|
||||
|
||||
/// <summary>
|
||||
/// 初始化指引箭头
|
||||
/// </summary>
|
||||
|
||||
private void InitializeGuideArrow()
|
||||
{
|
||||
// 检查预制体是否存在
|
||||
if (GuideArrowPre == null)
|
||||
{
|
||||
Debug.LogError("GuideArrowPre 预制体未分配!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 实例化指引箭头预制体
|
||||
guideArrowInstance = Instantiate(GuideArrowPre);
|
||||
guideArrowInstance.name = "GuideArrow";
|
||||
|
||||
// 获取指引箭头组件
|
||||
guideArrowComponent = guideArrowInstance.GetComponent<GuideArrowPath>();
|
||||
if (guideArrowComponent == null)
|
||||
{
|
||||
Debug.LogError("GuideArrowPre 预制体上没有找到 GuideArrowPath 组件!");
|
||||
Destroy(guideArrowInstance);
|
||||
guideArrowInstance = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置指引箭头的层级和高度
|
||||
guideArrowComponent.obstacleMask = LayerMask.GetMask("Default"); // 根据实际障碍物层级设置
|
||||
guideArrowComponent.pathHeight = 0.5f; // 设置路径显示高度
|
||||
|
||||
// 初始隐藏指引
|
||||
guideArrowComponent.ClosePath();
|
||||
|
||||
// 可选:设置父物体,保持场景整洁
|
||||
guideArrowInstance.transform.SetParent(this.transform);
|
||||
|
||||
// 初始化玩家位置
|
||||
if (GameInit.Ins.self != null)
|
||||
{
|
||||
lastPlayerPosition = GameInit.Ins.self.transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指引箭头位置(实时跟随玩家移动)
|
||||
/// </summary>
|
||||
|
||||
// 修改 UpdateGuideArrowPosition 方法
|
||||
private void UpdateGuideArrowPosition()
|
||||
{
|
||||
if (!isGuideArrowActive || gameStartPointPre == null || GameInit.Ins.self == null)
|
||||
return;
|
||||
|
||||
// 获取玩家当前位置
|
||||
Vector3 currentPlayerPosition = GameInit.Ins.self.transform.position;
|
||||
|
||||
// 检查冷却时间
|
||||
if (Time.time - lastPathUpdateTime < updatePathCooldown)
|
||||
return;
|
||||
|
||||
// 检查玩家是否移动了足够远的距离
|
||||
float distanceMoved = Vector3.Distance(currentPlayerPosition, lastPlayerPosition);
|
||||
|
||||
if (distanceMoved > updatePathThreshold)
|
||||
{
|
||||
// 获取门的位置
|
||||
Vector3 doorPosition = gameStartPointPre.transform.position;
|
||||
|
||||
// 使用曲线检测和路径平滑
|
||||
UpdatePathWithCurveDetection(currentPlayerPosition, doorPosition);
|
||||
|
||||
// 更新记录的位置和时间
|
||||
lastPlayerPosition = currentPlayerPosition;
|
||||
lastPathUpdateTime = Time.time;
|
||||
}
|
||||
}
|
||||
|
||||
// 新增:使用曲线检测和路径平滑的方法
|
||||
private void UpdatePathWithCurveDetection(Vector3 start, Vector3 end)
|
||||
{
|
||||
if (guideArrowComponent == null)
|
||||
return;
|
||||
|
||||
// 1. 检测是否为直接可见路径
|
||||
if (IsDirectPathClear(start, end))
|
||||
{
|
||||
// 直接路径,使用简单的贝塞尔曲线
|
||||
smoothedPath = GenerateBezierCurve(start, end, 0.2f);
|
||||
guideArrowComponent.SetPath(smoothedPath); // 这里使用 List<Vector3> 参数
|
||||
isPathSmoothed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 间接路径,使用优化的绕路算法
|
||||
List<Vector3> newPath = CalculateObstacleAvoidancePath(start, end);
|
||||
|
||||
if (newPath != null && newPath.Count > 1)
|
||||
{
|
||||
// 应用路径平滑
|
||||
smoothedPath = SmoothPath(newPath);
|
||||
guideArrowComponent.SetPath(smoothedPath); // 这里使用 List<Vector3> 参数
|
||||
isPathSmoothed = true;
|
||||
lastPathPoints = smoothedPath.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
// 新增:检查直接路径是否畅通
|
||||
private bool IsDirectPathClear(Vector3 start, Vector3 end)
|
||||
{
|
||||
Vector3 direction = (end - start).normalized;
|
||||
float distance = Vector3.Distance(start, end);
|
||||
|
||||
// 使用射线检测,同时检查多个点
|
||||
int checkPoints = Mathf.CeilToInt(distance / 0.5f);
|
||||
for (int i = 0; i <= checkPoints; i++)
|
||||
{
|
||||
float t = (float)i / checkPoints;
|
||||
Vector3 checkPoint = Vector3.Lerp(start, end, t);
|
||||
|
||||
// 检查周围小范围的碰撞
|
||||
if (Physics.CheckSphere(checkPoint, 0.3f, guideArrowComponent.obstacleMask))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 新增:生成贝塞尔曲线路径
|
||||
private List<Vector3> GenerateBezierCurve(Vector3 start, Vector3 end, float curveHeight)
|
||||
{
|
||||
List<Vector3> curvePoints = new List<Vector3>();
|
||||
int segments = 20; // 曲线分段数
|
||||
|
||||
// 计算控制点(在中间稍微抬起形成曲线)
|
||||
Vector3 controlPoint = (start + end) * 0.5f + Vector3.up * curveHeight;
|
||||
|
||||
for (int i = 0; i <= segments; i++)
|
||||
{
|
||||
float t = (float)i / segments;
|
||||
|
||||
// 二次贝塞尔曲线公式
|
||||
Vector3 point = (1 - t) * (1 - t) * start +
|
||||
2 * (1 - t) * t * controlPoint +
|
||||
t * t * end;
|
||||
|
||||
curvePoints.Add(point);
|
||||
}
|
||||
|
||||
return curvePoints;
|
||||
}
|
||||
|
||||
// 新增:优化后的绕障碍物路径计算
|
||||
private List<Vector3> CalculateObstacleAvoidancePath(Vector3 start, Vector3 end)
|
||||
{
|
||||
List<Vector3> path = new List<Vector3>();
|
||||
path.Add(start);
|
||||
|
||||
// 尝试寻找最佳绕行点
|
||||
Vector3 bypassPoint = FindOptimalBypassPoint(start, end);
|
||||
|
||||
if (bypassPoint != start)
|
||||
{
|
||||
// 如果有绕行点,构建曲线路径
|
||||
List<Vector3> curve1 = GenerateBezierCurve(start, bypassPoint, 0.3f);
|
||||
List<Vector3> curve2 = GenerateBezierCurve(bypassPoint, end, 0.3f);
|
||||
|
||||
path.AddRange(curve1.Skip(1));
|
||||
path.AddRange(curve2.Skip(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 没有找到绕行点,使用简单的曲线
|
||||
path = GenerateBezierCurve(start, end, 0.2f);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
// 新增:寻找最优绕行点
|
||||
private Vector3 FindOptimalBypassPoint(Vector3 from, Vector3 to)
|
||||
{
|
||||
Vector3 direction = (to - from).normalized;
|
||||
float distance = Vector3.Distance(from, to);
|
||||
|
||||
// 定义多个探测方向
|
||||
Vector3[] probeDirections = new Vector3[]
|
||||
{
|
||||
Vector3.Cross(direction, Vector3.up).normalized, // 右侧
|
||||
-Vector3.Cross(direction, Vector3.up).normalized, // 左侧
|
||||
(Vector3.Cross(direction, Vector3.up).normalized + Vector3.up * 0.3f).normalized, // 右上
|
||||
(-Vector3.Cross(direction, Vector3.up).normalized + Vector3.up * 0.3f).normalized // 左上
|
||||
};
|
||||
|
||||
float[] probeDistances = new float[] { 2f, 3f, 4f, 5f };
|
||||
|
||||
Vector3 bestBypassPoint = from;
|
||||
float bestScore = float.MaxValue;
|
||||
|
||||
foreach (Vector3 probeDir in probeDirections)
|
||||
{
|
||||
foreach (float probeDist in probeDistances)
|
||||
{
|
||||
Vector3 probePoint = from + probeDir * probeDist;
|
||||
|
||||
// 检查探测点是否可行
|
||||
if (!Physics.CheckSphere(probePoint, 0.5f, guideArrowComponent.obstacleMask))
|
||||
{
|
||||
// 计算路径分数(距离 + 转向角度)
|
||||
float pathLength = Vector3.Distance(from, probePoint) +
|
||||
Vector3.Distance(probePoint, to);
|
||||
float angleCost = Vector3.Angle(probePoint - from, to - probePoint) * 0.1f;
|
||||
float score = pathLength + angleCost;
|
||||
|
||||
if (score < bestScore)
|
||||
{
|
||||
bestScore = score;
|
||||
bestBypassPoint = probePoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bestBypassPoint;
|
||||
}
|
||||
|
||||
// 新增:路径平滑算法
|
||||
private List<Vector3> SmoothPath(List<Vector3> rawPath)
|
||||
{
|
||||
if (rawPath.Count < 3)
|
||||
return rawPath;
|
||||
|
||||
List<Vector3> smoothed = new List<Vector3>();
|
||||
smoothed.Add(rawPath[0]);
|
||||
|
||||
// 使用简单的平均平滑
|
||||
for (int i = 1; i < rawPath.Count - 1; i++)
|
||||
{
|
||||
Vector3 smoothedPoint = (rawPath[i - 1] + rawPath[i] + rawPath[i + 1]) / 3f;
|
||||
smoothed.Add(smoothedPoint);
|
||||
}
|
||||
|
||||
smoothed.Add(rawPath[rawPath.Count - 1]);
|
||||
|
||||
return smoothed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示指引箭头
|
||||
/// </summary>
|
||||
|
||||
public void ShowGuideArrow()
|
||||
{
|
||||
if (guideArrowComponent != null && gameStartPointPre != null && GameInit.Ins.self != null)
|
||||
{
|
||||
guideArrowComponent.ShowPath();
|
||||
isGuideArrowActive = true;
|
||||
|
||||
// 初始化路径
|
||||
Vector3 playerPosition = GameInit.Ins.self.transform.position;
|
||||
Vector3 doorPosition = gameStartPointPre.transform.position;
|
||||
UpdatePathWithCurveDetection(playerPosition, doorPosition);
|
||||
|
||||
// 记录初始位置
|
||||
lastPlayerPosition = playerPosition;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 隐藏指引箭头
|
||||
/// </summary>
|
||||
|
||||
public void HideGuideArrow()
|
||||
{
|
||||
if (guideArrowComponent != null)
|
||||
{
|
||||
guideArrowComponent.ClosePath();
|
||||
isGuideArrowActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始指引(在创建门后调用)
|
||||
/// </summary>
|
||||
|
||||
public void StartGuide()
|
||||
{
|
||||
if (gameStartPointPre != null && GameInit.Ins.self != null)
|
||||
{
|
||||
ShowGuideArrow();
|
||||
|
||||
// 初始化路径
|
||||
Vector3 playerPosition = GameInit.Ins.self.transform.position;
|
||||
Vector3 doorPosition = gameStartPointPre.transform.position;
|
||||
|
||||
// 使用新的路径计算方法
|
||||
UpdatePathWithCurveDetection(playerPosition, doorPosition);
|
||||
|
||||
// 记录初始位置
|
||||
lastPlayerPosition = playerPosition;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止指引(在游戏开始或删除门时调用)
|
||||
/// </summary>
|
||||
|
||||
public void StopGuide()
|
||||
{
|
||||
HideGuideArrow();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理指引箭头实例
|
||||
/// </summary>
|
||||
|
||||
public void CleanupGuideArrow()
|
||||
{
|
||||
if (guideArrowInstance != null)
|
||||
{
|
||||
Destroy(guideArrowInstance);
|
||||
guideArrowInstance = null;
|
||||
guideArrowComponent = null;
|
||||
isGuideArrowActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -55,45 +55,45 @@ public class LoginPanel : MonoBehaviour
|
||||
|
||||
public void Author()
|
||||
{
|
||||
////延迟请求
|
||||
//MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
//{
|
||||
// // 登录
|
||||
// GameManager.Ins.Request((req, response) =>
|
||||
//延迟请求
|
||||
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
// 登录
|
||||
GameManager.Ins.Request((req, response) =>
|
||||
|
||||
// {
|
||||
// RequestLoginCount++;
|
||||
// if (response == null)
|
||||
// {
|
||||
// Debug.Log("鉴权失败1");
|
||||
// if (RequestLoginCount < 2)
|
||||
// {
|
||||
// Author();
|
||||
// return;
|
||||
// }
|
||||
// PanelState.StateChange(1);
|
||||
// return;
|
||||
// }
|
||||
// ResponseInfo info = JsonUtility.FromJson<ResponseInfo>(response.DataAsText);
|
||||
// if (info.code < 200 || info.code >= 300)
|
||||
// {
|
||||
// Debug.Log("鉴权失败2");
|
||||
// if (RequestLoginCount < 2)
|
||||
// {
|
||||
// Author();
|
||||
// return;
|
||||
// }
|
||||
// PanelState.StateChange(1);
|
||||
// return;
|
||||
// }
|
||||
{
|
||||
RequestLoginCount++;
|
||||
if (response == null)
|
||||
{
|
||||
Debug.Log("鉴权失败1");
|
||||
if (RequestLoginCount < 2)
|
||||
{
|
||||
Author();
|
||||
return;
|
||||
}
|
||||
PanelState.StateChange(1);
|
||||
return;
|
||||
}
|
||||
ResponseInfo info = JsonUtility.FromJson<ResponseInfo>(response.DataAsText);
|
||||
if (info.code < 200 || info.code >= 300)
|
||||
{
|
||||
Debug.Log("鉴权失败2");
|
||||
if (RequestLoginCount < 2)
|
||||
{
|
||||
Author();
|
||||
return;
|
||||
}
|
||||
PanelState.StateChange(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (info.code == 200)
|
||||
// {
|
||||
// GameManager.Ins.InitData();
|
||||
// _isLogin = true;
|
||||
// }
|
||||
// });
|
||||
//}, 1);
|
||||
if (info.code == 200)
|
||||
{
|
||||
GameManager.Ins.InitData();
|
||||
_isLogin = true;
|
||||
}
|
||||
});
|
||||
}, 1);
|
||||
}
|
||||
|
||||
IEnumerator Progress()
|
||||
@@ -104,8 +104,8 @@ public class LoginPanel : MonoBehaviour
|
||||
_progress = 0;
|
||||
_isLogin = false;
|
||||
|
||||
GameManager.Ins.InitData();
|
||||
_isLogin = true;//修改为本地游戏
|
||||
//GameManager.Ins.InitData();
|
||||
//_isLogin = true;//修改为本地游戏
|
||||
float curWaitTime = 0;
|
||||
|
||||
while (_progress<=90)
|
||||
|
||||
Reference in New Issue
Block a user