|
|
|
|
@ -3,6 +3,8 @@ using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using LzFramework;
|
|
|
|
|
using EduCoderTool;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace DisComputer
|
|
|
|
|
{
|
|
|
|
|
@ -14,22 +16,7 @@ namespace DisComputer
|
|
|
|
|
public class PcControl : Singleton<PcControl>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public SpareItemControl zhubanControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl yingPanControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl dianYuanControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl guangQuControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl xianKaControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl cpuControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl neiCunTiaoControl;
|
|
|
|
|
|
|
|
|
|
public SpareItemControl jiXiangControl;
|
|
|
|
|
|
|
|
|
|
public List<SpareAnimationInfo> spareAnimationInfos;
|
|
|
|
|
|
|
|
|
|
private int curSpIndex = 0;
|
|
|
|
|
|
|
|
|
|
@ -44,115 +31,96 @@ namespace DisComputer
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
if ( Input.GetKey(KeyCode.U) &&Input.GetKeyDown(KeyCode.Alpha1))
|
|
|
|
|
{
|
|
|
|
|
jiXiangControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha1))
|
|
|
|
|
{
|
|
|
|
|
jiXiangControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha2))
|
|
|
|
|
{
|
|
|
|
|
neiCunTiaoControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha2))
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.U))
|
|
|
|
|
{
|
|
|
|
|
neiCunTiaoControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
SetUnloadState(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha3))
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.B))
|
|
|
|
|
{
|
|
|
|
|
yingPanControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha3))
|
|
|
|
|
{
|
|
|
|
|
yingPanControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
SetLoadState(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha4))
|
|
|
|
|
|
|
|
|
|
//重置安装模式
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
|
|
|
{
|
|
|
|
|
xianKaControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
if(GameConfig.state == GameState.Load)
|
|
|
|
|
{
|
|
|
|
|
GameConfig.state = GameState.Unload;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GameConfig.state = GameState.Load;
|
|
|
|
|
}
|
|
|
|
|
Debug.LogFormat(">>>>>>>>>> cur SP index {0}", curSpIndex);
|
|
|
|
|
curSpIndex--;
|
|
|
|
|
ReadyLoadNextStep(0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha4))
|
|
|
|
|
{
|
|
|
|
|
xianKaControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha5))
|
|
|
|
|
{
|
|
|
|
|
cpuControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha5))
|
|
|
|
|
{
|
|
|
|
|
cpuControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha6))
|
|
|
|
|
{
|
|
|
|
|
dianYuanControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha6))
|
|
|
|
|
{
|
|
|
|
|
dianYuanControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha7))
|
|
|
|
|
{
|
|
|
|
|
guangQuControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha7))
|
|
|
|
|
{
|
|
|
|
|
guangQuControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKey(KeyCode.U) && Input.GetKeyDown(KeyCode.Alpha8))
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置拆机步数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="step"></param>
|
|
|
|
|
public void SetUnloadState(int step)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < spareAnimationInfos.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
zhubanControl.spareAnimation.OnUnLoadAct();
|
|
|
|
|
if (i < step)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("*** Set UnloadMode 隐藏 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetUnloadState();
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("*** Set UnloadMode 显示 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetLoadState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKey(KeyCode.R) && Input.GetKeyDown(KeyCode.Alpha8))
|
|
|
|
|
{
|
|
|
|
|
zhubanControl.spareAnimation.OnLoadAct();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重置安装模式
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Space))
|
|
|
|
|
curSpIndex = step;
|
|
|
|
|
SetNextSpareType();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置装机步数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="step"></param>
|
|
|
|
|
public void SetLoadState(int step)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < spareAnimationInfos.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if(GameConfig.state == GameState.Load)
|
|
|
|
|
if(i < step)
|
|
|
|
|
{
|
|
|
|
|
GameConfig.state = GameState.Unload;
|
|
|
|
|
Debug.LogFormat("*** Set loadMode 显示 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetLoadState();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GameConfig.state = GameState.Load;
|
|
|
|
|
Debug.LogFormat("*** Set loadMode 隐藏 {0} ", spareAnimationInfos[i].type);
|
|
|
|
|
spareAnimationInfos[i].control.spareAnimation.SetUnloadState();
|
|
|
|
|
}
|
|
|
|
|
Debug.LogFormat(">>>>>>>>>> cur SP index {0}", curSpIndex);
|
|
|
|
|
curSpIndex--;
|
|
|
|
|
ReadyLoadNextStep(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
curSpIndex = 8 - step;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetNextSpareType();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 注册零件控制事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
@ -192,7 +160,7 @@ namespace DisComputer
|
|
|
|
|
curSpIndex++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Debug.LogFormat(" *** cur index {0}",curSpIndex);
|
|
|
|
|
//Debug.LogFormat(" *** cur index {0}",curSpIndex);
|
|
|
|
|
if (curSpIndex > 8)//拆装成功
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("拆卸成功!!!");
|
|
|
|
|
@ -218,10 +186,10 @@ namespace DisComputer
|
|
|
|
|
{
|
|
|
|
|
isReadyed = true;
|
|
|
|
|
curSpIndex--;
|
|
|
|
|
Debug.LogFormat(" ----- cur index {0}", curSpIndex);
|
|
|
|
|
//Debug.LogFormat(" ----- cur index {0}", curSpIndex);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Debug.LogFormat(" *** cur index {0}", curSpIndex);
|
|
|
|
|
//Debug.LogFormat(" *** cur index {0}", curSpIndex);
|
|
|
|
|
if (curSpIndex <= 0) {//全部安装成功
|
|
|
|
|
curSpIndex = 1;
|
|
|
|
|
StartCoroutine(FinishLoadMode());
|
|
|
|
|
@ -255,6 +223,12 @@ namespace DisComputer
|
|
|
|
|
IEnumerator FinishUnLoadMode()
|
|
|
|
|
{
|
|
|
|
|
yield return new WaitForSeconds(2.50f);
|
|
|
|
|
WebData webData = new WebData();
|
|
|
|
|
webData.Data = "";
|
|
|
|
|
webData.GameState = "Success";
|
|
|
|
|
string json = JsonConvert.SerializeObject(webData);
|
|
|
|
|
|
|
|
|
|
WebConnecter.Singleton.SendDataToWeb(json);
|
|
|
|
|
string tipStr = string.Format("恭喜你顺利通过<color=red>拆卸课程</color>,接下来进入组装课程!加油!!");
|
|
|
|
|
MessageContainer.SendMessage("",this,MsgName.MainViewQuitFocuseMode);
|
|
|
|
|
yield return new WaitForSeconds(0.5f);
|
|
|
|
|
@ -272,6 +246,14 @@ namespace DisComputer
|
|
|
|
|
yield return new WaitForSeconds(2.50f);
|
|
|
|
|
string tipStr = string.Format("恭喜你顺利通过<color=red>安装课程</color>,并掌握了计算机拆装!!");
|
|
|
|
|
MessageContainer.SendMessage("", this, MsgName.MainViewQuitFocuseMode);
|
|
|
|
|
|
|
|
|
|
WebData webData = new WebData();
|
|
|
|
|
webData.Data = "";
|
|
|
|
|
webData.GameState = "Success";
|
|
|
|
|
string json = JsonConvert.SerializeObject(webData);
|
|
|
|
|
|
|
|
|
|
WebConnecter.Singleton.SendDataToWeb(json);
|
|
|
|
|
|
|
|
|
|
yield return new WaitForSeconds(0.50f);
|
|
|
|
|
LzFramework.UI.TTUIPage.ShowPage<EndView>(tipStr);
|
|
|
|
|
}
|
|
|
|
|
@ -285,7 +267,7 @@ namespace DisComputer
|
|
|
|
|
/// </summary>
|
|
|
|
|
void UnloadFinish()
|
|
|
|
|
{
|
|
|
|
|
Debug.LogFormat("当前{0}拆除成功",curSpType.ToString());
|
|
|
|
|
// Debug.LogFormat("当前{0}拆除成功",curSpType.ToString());
|
|
|
|
|
isReadyed = false;
|
|
|
|
|
MessageContainer.SendMessage("quit", this, MsgName.TipViewShowOperation);
|
|
|
|
|
HideTipSpare();
|
|
|
|
|
@ -300,7 +282,7 @@ namespace DisComputer
|
|
|
|
|
void LoadFinish()
|
|
|
|
|
{
|
|
|
|
|
isReadyed = false;
|
|
|
|
|
Debug.LogFormat("当前{0}安装成功", curSpType.ToString());
|
|
|
|
|
//Debug.LogFormat("当前{0}安装成功", curSpType.ToString());
|
|
|
|
|
HideTipSpare();
|
|
|
|
|
string spareName = CommonTool.GetSpareName(curSpType);
|
|
|
|
|
string tip = string.Format("恭喜你完成了<color=red>{0}</color>的安装", spareName);
|
|
|
|
|
@ -349,37 +331,16 @@ namespace DisComputer
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
void SetSpareControl(SpareType type)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < spareAnimationInfos.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
case SpareType.Cpu:
|
|
|
|
|
curSpControl = cpuControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.DianYuan:
|
|
|
|
|
curSpControl = dianYuanControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.GuangQu:
|
|
|
|
|
curSpControl = guangQuControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.JiXiang:
|
|
|
|
|
curSpControl = jiXiangControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.NeiCun:
|
|
|
|
|
curSpControl = neiCunTiaoControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.Null:
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.XianKa:
|
|
|
|
|
curSpControl = xianKaControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.YingPan:
|
|
|
|
|
curSpControl = yingPanControl;
|
|
|
|
|
break;
|
|
|
|
|
case SpareType.ZhuBan:
|
|
|
|
|
curSpControl = zhubanControl;
|
|
|
|
|
break;
|
|
|
|
|
if(spareAnimationInfos[i].type == type)
|
|
|
|
|
{
|
|
|
|
|
curSpControl = spareAnimationInfos[i].control;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curSpControl.ActiveRegistType(type);
|
|
|
|
|
|
|
|
|
|
@ -389,5 +350,12 @@ namespace DisComputer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class SpareAnimationInfo
|
|
|
|
|
{
|
|
|
|
|
public SpareType type;
|
|
|
|
|
public SpareItemControl control;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|