|
|
|
|
@ -18,7 +18,9 @@ namespace DisComputer
|
|
|
|
|
|
|
|
|
|
public List<SpareAnimationInfo> spareAnimationInfos;
|
|
|
|
|
|
|
|
|
|
private int curSpIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int curSpIndex = -1;
|
|
|
|
|
|
|
|
|
|
//当前控制器下标
|
|
|
|
|
private SpareType curSpType;
|
|
|
|
|
@ -26,44 +28,12 @@ namespace DisComputer
|
|
|
|
|
private SpareItemControl curSpControl;
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.U))
|
|
|
|
|
{
|
|
|
|
|
SetUnloadState(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.B))
|
|
|
|
|
{
|
|
|
|
|
SetLoadState(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//重置安装模式
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
|
|
|
{
|
|
|
|
|
if(GameConfig.state == GameState.Load)
|
|
|
|
|
{
|
|
|
|
|
GameConfig.state = GameState.Unload;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GameConfig.state = GameState.Load;
|
|
|
|
|
}
|
|
|
|
|
Debug.LogFormat(">>>>>>>>>> cur SP index {0}", curSpIndex);
|
|
|
|
|
curSpIndex--;
|
|
|
|
|
ReadyLoadNextStep(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -76,17 +46,22 @@ namespace DisComputer
|
|
|
|
|
{
|
|
|
|
|
if (i < step)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("*** Set UnloadMode 隐藏 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
//Debug.LogFormat("*** Set UnloadMode 隐藏 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetUnloadState();
|
|
|
|
|
}else
|
|
|
|
|
spareAnimationInfos[i].control.DisableLoadColor();
|
|
|
|
|
spareAnimationInfos[i].control.DisableAllOutLine();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("*** Set UnloadMode 显示 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
//Debug.LogFormat("*** Set UnloadMode 显示 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetLoadState();
|
|
|
|
|
spareAnimationInfos[i].control.DisableLoadColor();
|
|
|
|
|
spareAnimationInfos[i].control.DisableAllOutLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
curSpIndex = step;
|
|
|
|
|
curSpIndex = step;
|
|
|
|
|
SetNextSpareType();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -97,26 +72,29 @@ namespace DisComputer
|
|
|
|
|
/// <param name="step"></param>
|
|
|
|
|
public void SetLoadState(int step)
|
|
|
|
|
{
|
|
|
|
|
step = 7 - step;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < spareAnimationInfos.Count; i++)
|
|
|
|
|
for (int i = spareAnimationInfos.Count-1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
if(i < step)
|
|
|
|
|
//Debug.LogFormat("i {0} step {1}",i,step);
|
|
|
|
|
if(i <= step)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("*** Set loadMode 显示 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetLoadState();
|
|
|
|
|
//Debug.LogFormat("*** Set loadMode 隐藏 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetUnloadState();
|
|
|
|
|
spareAnimationInfos[i].control.DisableLoadColor();
|
|
|
|
|
spareAnimationInfos[i].control.DisableAllOutLine();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("*** Set loadMode 隐藏 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetUnloadState();
|
|
|
|
|
|
|
|
|
|
//Debug.LogFormat("*** Set loadMode 显示 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetLoadState();
|
|
|
|
|
spareAnimationInfos[i].control.DisableLoadColor();
|
|
|
|
|
spareAnimationInfos[i].control.DisableAllOutLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
curSpIndex = 8 - step;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curSpIndex = step;
|
|
|
|
|
SetNextSpareType();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -145,23 +123,19 @@ namespace DisComputer
|
|
|
|
|
curSpControl.ShowOutline();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//当前数据是否已经准备
|
|
|
|
|
bool isReadyed = false;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 准备拆卸下一个步骤数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ReadyUnloadNextStep(float delay)
|
|
|
|
|
{
|
|
|
|
|
if (!isReadyed)
|
|
|
|
|
{
|
|
|
|
|
isReadyed = true;
|
|
|
|
|
//隐藏零件展示
|
|
|
|
|
RendereSpareControl.Instance.HideSpareRenderer();
|
|
|
|
|
curSpIndex++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Debug.LogFormat(" *** cur index {0}",curSpIndex);
|
|
|
|
|
if (curSpIndex > 8)//拆装成功
|
|
|
|
|
//隐藏零件展示
|
|
|
|
|
RendereSpareControl.Instance.HideSpareRenderer();
|
|
|
|
|
curSpIndex++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Debug.LogFormat(" --- unload mode cur index {0}", curSpIndex);
|
|
|
|
|
if (curSpIndex > 7)//拆装成功
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("拆卸成功!!!");
|
|
|
|
|
StartCoroutine(FinishUnLoadMode());
|
|
|
|
|
@ -174,7 +148,7 @@ namespace DisComputer
|
|
|
|
|
SetNextSpareType();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -182,16 +156,10 @@ namespace DisComputer
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ReadyLoadNextStep(float delay)
|
|
|
|
|
{
|
|
|
|
|
if (!isReadyed)
|
|
|
|
|
{
|
|
|
|
|
isReadyed = true;
|
|
|
|
|
curSpIndex--;
|
|
|
|
|
//Debug.LogFormat(" ----- cur index {0}", curSpIndex);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//Debug.LogFormat(" *** cur index {0}", curSpIndex);
|
|
|
|
|
if (curSpIndex <= 0) {//全部安装成功
|
|
|
|
|
curSpIndex = 1;
|
|
|
|
|
curSpIndex--;
|
|
|
|
|
Debug.LogFormat(" *** cur index {0}", curSpIndex);
|
|
|
|
|
if (curSpIndex <= -1) {//全部安装成功
|
|
|
|
|
curSpIndex = -1;
|
|
|
|
|
StartCoroutine(FinishLoadMode());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@ -267,11 +235,8 @@ namespace DisComputer
|
|
|
|
|
/// </summary>
|
|
|
|
|
void UnloadFinish()
|
|
|
|
|
{
|
|
|
|
|
// Debug.LogFormat("当前{0}拆除成功",curSpType.ToString());
|
|
|
|
|
isReadyed = false;
|
|
|
|
|
MessageContainer.SendMessage("quit", this, MsgName.TipViewShowOperation);
|
|
|
|
|
HideTipSpare();
|
|
|
|
|
|
|
|
|
|
HideTipSpare();
|
|
|
|
|
//显示零件展示
|
|
|
|
|
RendereSpareControl.Instance.ShowSpareRenderer(curSpType);
|
|
|
|
|
}
|
|
|
|
|
@ -281,13 +246,12 @@ namespace DisComputer
|
|
|
|
|
/// </summary>
|
|
|
|
|
void LoadFinish()
|
|
|
|
|
{
|
|
|
|
|
isReadyed = false;
|
|
|
|
|
//Debug.LogFormat("当前{0}安装成功", curSpType.ToString());
|
|
|
|
|
|
|
|
|
|
HideTipSpare();
|
|
|
|
|
string spareName = CommonTool.GetSpareName(curSpType);
|
|
|
|
|
string tip = string.Format("恭喜你完成了<color=red>{0}</color>的安装", spareName);
|
|
|
|
|
MessageContainer.SendMessage(tip, this, MsgName.TipViewShowPoint);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MessageContainer.SendMessage("temp", this, MsgName.MainViewGrowthBar,0.5f);
|
|
|
|
|
//准备安装下一个
|
|
|
|
|
ReadyLoadNextStep(1.5f);
|
|
|
|
|
@ -299,6 +263,7 @@ namespace DisComputer
|
|
|
|
|
void SetNextSpareType()
|
|
|
|
|
{
|
|
|
|
|
SpareType[] types = Enum.GetValues(typeof(SpareType))as SpareType[];
|
|
|
|
|
//Debug.LogFormat(">>>>>>>>>> curSpIndex {0}", curSpIndex);
|
|
|
|
|
curSpType = types[curSpIndex];
|
|
|
|
|
ShowOperationTip();
|
|
|
|
|
SetSpareControl(curSpType);
|
|
|
|
|
@ -331,21 +296,21 @@ namespace DisComputer
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
void SetSpareControl(SpareType type)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < spareAnimationInfos.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if(spareAnimationInfos[i].type == type)
|
|
|
|
|
|
|
|
|
|
if (spareAnimationInfos[i].type == type)
|
|
|
|
|
{
|
|
|
|
|
curSpControl = spareAnimationInfos[i].control;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curSpControl.ActiveRegistType(type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (curSpControl)
|
|
|
|
|
{
|
|
|
|
|
curSpControl.ActiveRegistType(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|