完成背包功能,制作镜子效果,完善流程逻辑
This commit is contained in:
commit
790ad8bb10
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a38e68328447cf144883eda220a17ea1
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7d281825900800f4592beeb0a62db8df
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,51 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 步骤状态(管理一个步骤下的所有需要初始化的状态)
|
||||||
|
/// </summary>
|
||||||
|
public class StepState : MonoBehaviour
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 步骤所处场景
|
||||||
|
/// </summary>
|
||||||
|
public E_SceneType initSceneType;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public int systemId;
|
||||||
|
[HideInInspector]
|
||||||
|
public int schemeId;
|
||||||
|
[HideInInspector]
|
||||||
|
public int subProcessId;
|
||||||
|
|
||||||
|
public List<StepStateBase> stepStateBases;
|
||||||
|
private Action<E_SceneType> callback;
|
||||||
|
|
||||||
|
public void Init()
|
||||||
|
{
|
||||||
|
stepStateBases = transform.GetComponentsInChildren<StepStateBase>(true).ToList();
|
||||||
|
subProcessId = int.Parse(gameObject.name);
|
||||||
|
schemeId = int.Parse(transform.parent.name);
|
||||||
|
systemId= int.Parse(transform.parent.parent.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册场景跳转回调
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="callback"></param>
|
||||||
|
public void AddResetChangeScene(Action<E_SceneType> callback)
|
||||||
|
{
|
||||||
|
this.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InvokeChangeScene()
|
||||||
|
{
|
||||||
|
if (callback != null)
|
||||||
|
{
|
||||||
|
callback(initSceneType);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b60c6991d2888da47850978d1051aa7f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 步骤状态类
|
||||||
|
/// </summary>
|
||||||
|
public class StepStateBase : MonoBehaviour
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 配置的步骤状态初始参数
|
||||||
|
/// </summary>
|
||||||
|
public string initStatePara;
|
||||||
|
|
||||||
|
private Action<string> callback;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置状态初始化方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="callback"> 配置的初始化参数 </param>
|
||||||
|
public void AddResetFunction(Action<string> callback)
|
||||||
|
{
|
||||||
|
this.callback = callback;
|
||||||
|
Debug.Log("步骤状态注册成功:" + gameObject.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行步骤状态初始化
|
||||||
|
/// </summary>
|
||||||
|
public void InvokeInitStepStae()
|
||||||
|
{
|
||||||
|
if (callback != null)
|
||||||
|
{
|
||||||
|
Debug.Log("步骤初始化:" + gameObject.name);
|
||||||
|
callback(initStatePara);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 40734e2dbb26ba24eaced19c3fbc57ae
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,84 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering.VirtualTexturing;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 步骤状态控制(配置步骤初始状态,断线重连步骤状态加载,步骤状态结果实时提交)
|
||||||
|
/// </summary>
|
||||||
|
public class StepStateControl : MonoBehaviour
|
||||||
|
{
|
||||||
|
//场景初始化
|
||||||
|
//背包初始化
|
||||||
|
//提示初始化
|
||||||
|
//设备初始化
|
||||||
|
//工具和材料初始化
|
||||||
|
//自定义初始化
|
||||||
|
|
||||||
|
public static StepStateControl instance;
|
||||||
|
List<StepState> m_Steps;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
instance = this;
|
||||||
|
m_Steps = transform.GetComponentsInChildren<StepState>(true).ToList();
|
||||||
|
m_Steps.ForEach(a=> { a.Init(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 注册当前科目里步骤里某个需要初始化的状态脚本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objName"></param>
|
||||||
|
public void AddStepStateBase(int[] subProcessIds,string objName,Action<string> callback)
|
||||||
|
{
|
||||||
|
List<StepState> ss=m_Steps.FindAll(a => a.systemId == GameManager.Instance.systemId && a.schemeId == GameManager.RunModelMgr.schemeID && subProcessIds.Contains(a.subProcessId));
|
||||||
|
if (ss.Count >0)
|
||||||
|
{
|
||||||
|
ss.ForEach(a=>
|
||||||
|
{
|
||||||
|
StepStateBase sb = a.stepStateBases.Find(a => a.gameObject.name == objName);
|
||||||
|
if (sb != null)
|
||||||
|
{
|
||||||
|
sb.AddResetFunction(callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 调用初始化步骤
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="process"></param>
|
||||||
|
/// <param name="subProcess"></param>
|
||||||
|
/// <param name="step"></param>
|
||||||
|
public void InvokeInitStepState(int systemId, int schemeId, int subProcessId)
|
||||||
|
{
|
||||||
|
StepState tmp=m_Steps.Find(a => a.systemId == systemId && a.schemeId == schemeId && a.subProcessId == subProcessId);
|
||||||
|
if (tmp != null)
|
||||||
|
{
|
||||||
|
Debug.Log("初始化步骤");
|
||||||
|
//跳场景
|
||||||
|
tmp.InvokeChangeScene();
|
||||||
|
//初始化base
|
||||||
|
tmp.stepStateBases.ForEach(a =>
|
||||||
|
{
|
||||||
|
a.InvokeInitStepStae();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 提交步骤完成状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="process"></param>
|
||||||
|
/// <param name="subProcess"></param>
|
||||||
|
/// <param name="step"></param>
|
||||||
|
/// <param name="score"></param>
|
||||||
|
public void SubmitStepState()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 614aca3f575a7014e9724a2ff85a8d25
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -66,6 +66,7 @@ public class D_SubProcessStep : I_Enter, I_Exit
|
||||||
{
|
{
|
||||||
//GetTriggerID();
|
//GetTriggerID();
|
||||||
UnityEngine.Debug.Log("进入当前子流程步骤:" + id + "_" + subProcessStepName);
|
UnityEngine.Debug.Log("进入当前子流程步骤:" + id + "_" + subProcessStepName);
|
||||||
|
StepStateControl.instance.InvokeInitStepState(GameManager.Instance.systemId, schemeId, subProcessId);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退出
|
/// 退出
|
||||||
|
|
|
@ -14,6 +14,11 @@ public class Device_Mobile : MonoBehaviour
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_highlight = GetComponent<HighlightEffect>();
|
_highlight = GetComponent<HighlightEffect>();
|
||||||
|
//注册状态初始化回调
|
||||||
|
StepStateControl.instance.AddStepStateBase(new int[]{3001,3002 },"手机", para =>
|
||||||
|
{
|
||||||
|
downIndex = int.Parse(para);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue