|
@@ -15,11 +15,8 @@ namespace GFGGame
|
|
|
private UI_PhotographUI _ui;
|
|
|
private GameObject _scenePrefab;
|
|
|
private GameObject _sceneObject;
|
|
|
- // private DressUpObjDataCache equipDataCache;
|
|
|
|
|
|
- // private const string MOVE = "MOVE";
|
|
|
- // private const string SCALE = "SCALE";
|
|
|
- // private const string ROTATION = "ROTATION";
|
|
|
+ private const int MAX_COUNT = 20;
|
|
|
private const float MaxScale = 2;
|
|
|
private const float MinScale = 0.1f;
|
|
|
private const string BgResPath = "Bg/BgRes";
|
|
@@ -29,16 +26,9 @@ namespace GFGGame
|
|
|
private const string RoleName = "Role";
|
|
|
private const string NpcPath = "Scene/Npc";
|
|
|
private const string BgResName = "BgRes";
|
|
|
- // private const string BorderResName = "BorderRes";
|
|
|
-
|
|
|
- // private GameObject bodyParent;
|
|
|
- // private GameObject bgParent;
|
|
|
- // private GameObject npcParent;
|
|
|
- // private GameObject borderParent;
|
|
|
- // private GameObject sceneParent;
|
|
|
|
|
|
private List<int> _listData = null;//当前选择的资源数据
|
|
|
- public List<int> _equipRoleData = new List<int>();//当前穿戴的角色数据
|
|
|
+ private List<GameObject> _itemGameObjs = new List<GameObject>();
|
|
|
public Dictionary<int, List<int>> _equipSceneData = new Dictionary<int, List<int>>();//当前穿戴的场景数据
|
|
|
private Dictionary<GameObject, float> _equipDistance = new Dictionary<GameObject, float>();
|
|
|
|
|
@@ -94,17 +84,20 @@ namespace GFGGame
|
|
|
_ui.m_comSelectBox.m_btnDelete.onTouchBegin.Add(OnTouchBtnDeleteBegin);
|
|
|
_ui.m_comSelectBox.m_btnDelete.onTouchEnd.Add(OnTouchBtnDeleteEnd);
|
|
|
|
|
|
+ _ui.m_btnUp.onClick.Add(OnClickBtnUp);
|
|
|
+ _ui.m_btnDown.onClick.Add(OnClickBtnDown);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
Input.multiTouchEnabled = true;
|
|
|
- // equipDataCache = EquipDataCache.cacher;
|
|
|
+
|
|
|
PhotographDataManager.Instance.ClassifyEquipData();
|
|
|
- _equipRoleData = PhotographDataManager.Instance._equipRoleData;
|
|
|
_equipSceneData = PhotographDataManager.Instance._equipSceneData;
|
|
|
|
|
|
+ _itemGameObjs.Clear();
|
|
|
if (_sceneObject == null)
|
|
|
{
|
|
|
_sceneObject = GameObject.Instantiate(_scenePrefab);
|
|
@@ -159,6 +152,11 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnListItemClick(EventContext context)
|
|
|
{
|
|
|
+ if (_itemGameObjs.Count >= MAX_COUNT)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("最多穿戴" + MAX_COUNT + "件物品");
|
|
|
+ return;
|
|
|
+ }
|
|
|
int itemID = (int)((context.data as GObject).data);
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemID);
|
|
|
|
|
@@ -209,7 +207,7 @@ namespace GFGGame
|
|
|
RaycastHit2D[] hit2Ds = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
|
|
|
if (hit2Ds.Length > 0)
|
|
|
{
|
|
|
- // maxLayer++;
|
|
|
+
|
|
|
lastPos = Vector2.zero;
|
|
|
|
|
|
hitGameObj = SceneController.GetFirstHitObj(hit2Ds);
|
|
@@ -408,7 +406,8 @@ namespace GFGGame
|
|
|
private void UpdateBody()
|
|
|
{
|
|
|
GameObject bodyParent = _sceneObject.transform.Find(RolePath).gameObject;
|
|
|
- SceneController.UpdatePhotographBody(_equipRoleData.ToArray(), _sceneObject, bodyParent);
|
|
|
+ SceneController.UpdatePhotographBody(PhotographDataManager.Instance._equipRoleData.ToArray(), _sceneObject, bodyParent);
|
|
|
+ _itemGameObjs.Add(bodyParent);
|
|
|
|
|
|
maxLayer = PhotographDataManager.Instance.GetMaxLayer(bodyParent, maxLayer) + 1;
|
|
|
}
|
|
@@ -436,6 +435,8 @@ namespace GFGGame
|
|
|
spr.sortingOrder = maxLayer;
|
|
|
tf.localPosition = new Vector2(-spr.bounds.center.x, -spr.bounds.center.y);
|
|
|
SceneController.SetBoxCollider2DToGameObject(tf.gameObject);
|
|
|
+ _itemGameObjs.Add(tf.parent.gameObject);
|
|
|
+
|
|
|
}
|
|
|
private void UpdateBorder(ItemCfg itemCfg)
|
|
|
{
|
|
@@ -467,6 +468,7 @@ namespace GFGGame
|
|
|
SceneController.AddItemToScene(_sceneObject, parentGameObj, itemCfg.id, 2, itemCfg.resLayer2);
|
|
|
|
|
|
maxLayer = PhotographDataManager.Instance.GetMaxLayer(parentGameObj, maxLayer) + 1;
|
|
|
+ _itemGameObjs.Add(parentGameObj);
|
|
|
|
|
|
if (!isDefaultLayer)
|
|
|
{
|
|
@@ -486,6 +488,7 @@ namespace GFGGame
|
|
|
SceneController.AddItemToScene(_sceneObject, parentGameObj, itemCfg.id, 1, itemCfg.resLayer1);
|
|
|
|
|
|
maxLayer = PhotographDataManager.Instance.GetMaxLayer(parentGameObj, maxLayer) + 1;
|
|
|
+ _itemGameObjs.Add(parentGameObj);
|
|
|
|
|
|
if (!isDefaultLayer)
|
|
|
{
|
|
@@ -553,6 +556,7 @@ namespace GFGGame
|
|
|
{
|
|
|
GameObject.DestroyImmediate(memoryHitGameObj);
|
|
|
}
|
|
|
+ _itemGameObjs.Remove(memoryHitGameObj);
|
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
|
|
|
|
}
|
|
@@ -567,6 +571,15 @@ namespace GFGGame
|
|
|
hitGameObj = null;
|
|
|
memoryHitGameObj = null;
|
|
|
}
|
|
|
+
|
|
|
+ private void OnClickBtnUp()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ private void OnClickBtnDown()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
private void OnClickBtnPhotograph()
|
|
|
{
|
|
|
_ui.target.visible = false;
|
|
@@ -600,8 +613,7 @@ namespace GFGGame
|
|
|
GameObject.Destroy(_sceneObject);
|
|
|
_sceneObject = null;
|
|
|
}
|
|
|
- // equipDataCache = null;
|
|
|
- _equipRoleData.Clear();
|
|
|
+
|
|
|
_equipSceneData.Clear();
|
|
|
hitGameObj = null;
|
|
|
memoryHitGameObj = null;
|