|
@@ -15,6 +15,8 @@ namespace GFGGame
|
|
}
|
|
}
|
|
public class PhotographDataManager : SingletonBase<PhotographDataManager>
|
|
public class PhotographDataManager : SingletonBase<PhotographDataManager>
|
|
{
|
|
{
|
|
|
|
+ public List<GameObject> itemGameObjs = new List<GameObject>();
|
|
|
|
+
|
|
public List<int> _equipRoleData = new List<int>();//当前穿戴的角色数据
|
|
public List<int> _equipRoleData = new List<int>();//当前穿戴的角色数据
|
|
public Dictionary<int, List<int>> _equipSceneData = new Dictionary<int, List<int>>();//当前穿戴的场景数据
|
|
public Dictionary<int, List<int>> _equipSceneData = new Dictionary<int, List<int>>();//当前穿戴的场景数据
|
|
|
|
|
|
@@ -126,10 +128,62 @@ namespace GFGGame
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public void SetLayer(GameObject parentObj, int layer, string state)
|
|
|
|
|
|
+ public void SetLayer(GameObject hitGameObj, string state)
|
|
|
|
+ {
|
|
|
|
+ if (state != "refresh")
|
|
|
|
+ {
|
|
|
|
+ int index = itemGameObjs.IndexOf(hitGameObj);
|
|
|
|
+ if (state != "top")
|
|
|
|
+ {
|
|
|
|
+ if (index < 0)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("未选中任物品");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (index == 0 && state == "down")
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("已经在最下层了");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (index == itemGameObjs.Count - 1 && state == "up")
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("已经在最上层了");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ GameObject gameObject = itemGameObjs[index];
|
|
|
|
+ itemGameObjs.RemoveAt(index);
|
|
|
|
+ if (state == "up")
|
|
|
|
+ {
|
|
|
|
+ itemGameObjs.Insert((index + 1), gameObject);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if (state == "down")
|
|
|
|
+ {
|
|
|
|
+ itemGameObjs.Insert((index - 1), gameObject);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if (state == "top")
|
|
|
|
+ {
|
|
|
|
+ itemGameObjs.Add(gameObject);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt(state + "操作失败");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < itemGameObjs.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ PhotographDataManager.Instance.ChangeLayer(itemGameObjs[i], i * 100, state);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private void ChangeLayer(GameObject parentObj, int layer, string state)
|
|
{
|
|
{
|
|
int count = 0;
|
|
int count = 0;
|
|
- if (state == "up")
|
|
|
|
|
|
+ if (state == "up" || state == "top")
|
|
{
|
|
{
|
|
count = layer - GetMinLayer(parentObj);
|
|
count = layer - GetMinLayer(parentObj);
|
|
}
|
|
}
|
|
@@ -212,5 +266,33 @@ namespace GFGGame
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void AddItemGameObject(GameObject parentGameObj, bool setLayer)
|
|
|
|
+ {
|
|
|
|
+ itemGameObjs.Add(parentGameObj);
|
|
|
|
+
|
|
|
|
+ if (setLayer)
|
|
|
|
+ {
|
|
|
|
+ int index = itemGameObjs.Count - 1;
|
|
|
|
+ PhotographDataManager.Instance.ChangeLayer(itemGameObjs[index], index * 100, "up");
|
|
|
|
+ }
|
|
|
|
+ itemGameObjs.Sort((GameObject a, GameObject b) =>
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ int layerA = PhotographDataManager.Instance.GetMinLayer(a);
|
|
|
|
+ int layerB = PhotographDataManager.Instance.GetMinLayer(b);
|
|
|
|
+ if (layerA < layerB)
|
|
|
|
+ {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ else if (layerA > layerB)
|
|
|
|
+ {
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|