|
@@ -13,23 +13,30 @@ namespace GFGGame
|
|
private UI_PhotographUI _ui;
|
|
private UI_PhotographUI _ui;
|
|
private GameObject _scenePrefab;
|
|
private GameObject _scenePrefab;
|
|
private GameObject _sceneObject;
|
|
private GameObject _sceneObject;
|
|
- private DressUpObjDataCache equipDataCache;
|
|
|
|
|
|
+ // private DressUpObjDataCache equipDataCache;
|
|
|
|
|
|
- private const string MOVE = "MOVE";
|
|
|
|
- private const string SCALE = "SCALE";
|
|
|
|
- private const string ROTATION = "ROTATION";
|
|
|
|
|
|
+ // private const string MOVE = "MOVE";
|
|
|
|
+ // private const string SCALE = "SCALE";
|
|
|
|
+ // private const string ROTATION = "ROTATION";
|
|
private const float MaxScale = 2;
|
|
private const float MaxScale = 2;
|
|
private const float MinScale = 0.1f;
|
|
private const float MinScale = 0.1f;
|
|
-
|
|
|
|
- private GameObject bodyParent;
|
|
|
|
- private GameObject bgParent;
|
|
|
|
- private GameObject npcParent;
|
|
|
|
- private GameObject borderParent;
|
|
|
|
- private GameObject sceneParent;
|
|
|
|
|
|
+ private const string BgResPath = "Bg/BgRes";
|
|
|
|
+ private const string BorderResPath = "Border/BorderRes";
|
|
|
|
+ private const string NpcResPath = "Scene/Npc/NpcRes";
|
|
|
|
+ private const string RolePath = "Scene/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;//当前选择的资源数据
|
|
private List<int> _listData = null;//当前选择的资源数据
|
|
- private List<int> _equipRoleData = new List<int>();//当前穿戴的角色数据
|
|
|
|
- private Dictionary<int, List<int>> _equipSceneData = new Dictionary<int, List<int>>();//当前穿戴的场景数据
|
|
|
|
|
|
+ public List<int> _equipRoleData = new List<int>();//当前穿戴的角色数据
|
|
|
|
+ public Dictionary<int, List<int>> _equipSceneData = new Dictionary<int, List<int>>();//当前穿戴的场景数据
|
|
private Dictionary<GameObject, float> _equipDistance = new Dictionary<GameObject, float>();
|
|
private Dictionary<GameObject, float> _equipDistance = new Dictionary<GameObject, float>();
|
|
|
|
|
|
private GameObject hitGameObj;//当前选中的物体(单指拖动,双指缩放旋转)
|
|
private GameObject hitGameObj;//当前选中的物体(单指拖动,双指缩放旋转)
|
|
@@ -58,7 +65,7 @@ namespace GFGGame
|
|
isfullScreen = true;
|
|
isfullScreen = true;
|
|
|
|
|
|
_ui.m_btnBg.onClick.Add(OnClickBtnBg);
|
|
_ui.m_btnBg.onClick.Add(OnClickBtnBg);
|
|
- _ui.m_btnChoose.onClick.Add(OnClickBtnChoose);
|
|
|
|
|
|
+ _ui.m_btnChoose.onClick.Add(SetUIView);
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
_ui.m_btnPhotograph.onClick.Add(OnClickBtnPhotograph);
|
|
_ui.m_btnPhotograph.onClick.Add(OnClickBtnPhotograph);
|
|
|
|
|
|
@@ -88,32 +95,26 @@ namespace GFGGame
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
Input.multiTouchEnabled = true;
|
|
Input.multiTouchEnabled = true;
|
|
- equipDataCache = EquipDataCache.cacher;
|
|
|
|
|
|
+ // equipDataCache = EquipDataCache.cacher;
|
|
|
|
+ PhotographDataManager.Instance.ClassifyEquipData();
|
|
|
|
+ _equipRoleData = PhotographDataManager.Instance._equipRoleData;
|
|
|
|
+ _equipSceneData = PhotographDataManager.Instance._equipSceneData;
|
|
|
|
|
|
if (_sceneObject == null)
|
|
if (_sceneObject == null)
|
|
{
|
|
{
|
|
_sceneObject = GameObject.Instantiate(_scenePrefab);
|
|
_sceneObject = GameObject.Instantiate(_scenePrefab);
|
|
EquipDataCache.cacher.setSceneObj(_sceneObject);
|
|
EquipDataCache.cacher.setSceneObj(_sceneObject);
|
|
- bgParent = _sceneObject.transform.Find("Bg").gameObject;
|
|
|
|
- bodyParent = _sceneObject.transform.Find("Scene/Role").gameObject;
|
|
|
|
- sceneParent = _sceneObject.transform.Find("Scene").gameObject;
|
|
|
|
- npcParent = _sceneObject.transform.Find("Scene/Npc").gameObject;
|
|
|
|
- borderParent = _sceneObject.transform.Find("Border").gameObject;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
pinchGesture = new PinchGesture(_ui.target);
|
|
pinchGesture = new PinchGesture(_ui.target);
|
|
pinchGesture.onAction.Add(OnPinch);
|
|
pinchGesture.onAction.Add(OnPinch);
|
|
rotationGesture = new RotationGesture(_ui.target);
|
|
rotationGesture = new RotationGesture(_ui.target);
|
|
rotationGesture.onAction.Add(OnRotate);
|
|
rotationGesture.onAction.Add(OnRotate);
|
|
|
|
|
|
_ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex = 0;
|
|
_ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex = 0;
|
|
- OnClickBtnChoose();
|
|
|
|
- RefreshList(EnumPhotographType.BG);
|
|
|
|
- DisposeEquipData();
|
|
|
|
|
|
|
|
- // SceneController.UpdatePhotographBgOrNpcOrBorder(_sceneObject, EnumPhotographType.BG, equipDataCache.bgId);
|
|
|
|
-
|
|
|
|
- UpdateBg(ItemCfgArray.Instance.GetCfg(equipDataCache.bgId));
|
|
|
|
|
|
+ RefreshList(EnumPhotographType.BG);
|
|
|
|
+ SetUIView();
|
|
|
|
+ UpdateBg(ItemCfgArray.Instance.GetCfg(EquipDataCache.cacher.bgId));
|
|
UpdateBody();
|
|
UpdateBody();
|
|
UpdateScene();
|
|
UpdateScene();
|
|
|
|
|
|
@@ -128,24 +129,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
_ui.m_ComSelectRes.m_list.numItems = 0;
|
|
_ui.m_ComSelectRes.m_list.numItems = 0;
|
|
|
|
|
|
- switch (index)
|
|
|
|
- {
|
|
|
|
- case EnumPhotographType.BG:
|
|
|
|
- _listData = PhotographDataManager.Instance.listBgData;
|
|
|
|
- break;
|
|
|
|
- case EnumPhotographType.NPC:
|
|
|
|
- _listData = PhotographDataManager.Instance.listNpcData;
|
|
|
|
- break;
|
|
|
|
- case EnumPhotographType.SCENE:
|
|
|
|
- _listData = PhotographDataManager.Instance.listSceneData;
|
|
|
|
- break;
|
|
|
|
- case EnumPhotographType.BORDER:
|
|
|
|
- _listData = PhotographDataManager.Instance.listBorderData;
|
|
|
|
- break;
|
|
|
|
- case EnumPhotographType.EFFECT:
|
|
|
|
- _listData = PhotographDataManager.Instance.listEffectData;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ _listData = PhotographDataManager.Instance.GetListData(index);
|
|
_ui.m_ComSelectRes.m_list.numItems = _listData.Count;
|
|
_ui.m_ComSelectRes.m_list.numItems = _listData.Count;
|
|
}
|
|
}
|
|
private void RenderListItem(int index, GObject obj)
|
|
private void RenderListItem(int index, GObject obj)
|
|
@@ -164,7 +148,6 @@ namespace GFGGame
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemID);
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemID);
|
|
|
|
|
|
EnumPhotographType type = (EnumPhotographType)_ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex;
|
|
EnumPhotographType type = (EnumPhotographType)_ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex;
|
|
-
|
|
|
|
switch (type)
|
|
switch (type)
|
|
{
|
|
{
|
|
case EnumPhotographType.BG:
|
|
case EnumPhotographType.BG:
|
|
@@ -174,7 +157,7 @@ namespace GFGGame
|
|
case EnumPhotographType.BORDER:
|
|
case EnumPhotographType.BORDER:
|
|
if (_listData.IndexOf(itemID) == 0)
|
|
if (_listData.IndexOf(itemID) == 0)
|
|
{
|
|
{
|
|
- Transform tf = _sceneObject.transform.Find("Border/BorderRes");
|
|
|
|
|
|
+ Transform tf = _sceneObject.transform.Find(BorderResPath);
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
if (spr != null)
|
|
if (spr != null)
|
|
{
|
|
{
|
|
@@ -213,6 +196,8 @@ namespace GFGGame
|
|
if (hit2Ds.Length > 0)
|
|
if (hit2Ds.Length > 0)
|
|
{
|
|
{
|
|
maxLayer++;
|
|
maxLayer++;
|
|
|
|
+ lastPos = Vector2.zero;
|
|
|
|
+
|
|
hitGameObj = SceneController.GetFirstHitObj(hit2Ds);
|
|
hitGameObj = SceneController.GetFirstHitObj(hit2Ds);
|
|
|
|
|
|
_ui.m_comSelectBox.m_btnDelete.visible = true;
|
|
_ui.m_comSelectBox.m_btnDelete.visible = true;
|
|
@@ -221,37 +206,21 @@ namespace GFGGame
|
|
_ui.m_comSelectBox.m_btnDelete.visible = false;
|
|
_ui.m_comSelectBox.m_btnDelete.visible = false;
|
|
}
|
|
}
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
- if (hitGameObj.name != "BgRes")//背景不可改动层级
|
|
|
|
|
|
+ if (hitGameObj.name != BgResName)//背景不可改动层级
|
|
{
|
|
{
|
|
hitGameObj = hitGameObj.transform.parent.gameObject;
|
|
hitGameObj = hitGameObj.transform.parent.gameObject;
|
|
|
|
|
|
- for (int i = 0; i < hitGameObj.transform.childCount; i++)
|
|
|
|
- {
|
|
|
|
- Transform obj = hitGameObj.transform.GetChild(i);
|
|
|
|
- string[] strs = obj.name.Split('_');
|
|
|
|
- if (strs.Length > 1 && strs[1] == "eff")
|
|
|
|
- {
|
|
|
|
- DressUpUtil.SetParticleSortingOrder(obj.gameObject, maxLayer);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- obj.GetComponent<SpriteRenderer>().sortingOrder = maxLayer;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // maxLayer = layer;
|
|
|
|
|
|
+ PhotographDataManager.Instance.SetItemLayer(hitGameObj, maxLayer);
|
|
_ui.m_comSelectBox.target.visible = true;
|
|
_ui.m_comSelectBox.target.visible = true;
|
|
|
|
|
|
}
|
|
}
|
|
SceneController.SetGameObjectCenter(hitGameObj);
|
|
SceneController.SetGameObjectCenter(hitGameObj);
|
|
|
|
+ memoryHitGameObj = hitGameObj;
|
|
|
|
|
|
distance = Input.mousePosition - Camera.main.WorldToScreenPoint(hitGameObj.transform.position);
|
|
distance = Input.mousePosition - Camera.main.WorldToScreenPoint(hitGameObj.transform.position);
|
|
|
|
|
|
- lastPos = Vector2.zero;
|
|
|
|
_ui.m_comSelectBox.target.rotation = -hitGameObj.transform.eulerAngles.z;
|
|
_ui.m_comSelectBox.target.rotation = -hitGameObj.transform.eulerAngles.z;
|
|
_ui.m_comSelectBox.target.size = SceneController.GetGameObjectSize(hitGameObj);
|
|
_ui.m_comSelectBox.target.size = SceneController.GetGameObjectSize(hitGameObj);
|
|
-
|
|
|
|
- memoryHitGameObj = hitGameObj;
|
|
|
|
-
|
|
|
|
ControllerSelectBoxPos();
|
|
ControllerSelectBoxPos();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -264,7 +233,6 @@ namespace GFGGame
|
|
Debug.Log("拖动");
|
|
Debug.Log("拖动");
|
|
ControllerObjectPos();
|
|
ControllerObjectPos();
|
|
ControllerSelectBoxPos();
|
|
ControllerSelectBoxPos();
|
|
-
|
|
|
|
}
|
|
}
|
|
private void OnTouchUIEnd(EventContext context)
|
|
private void OnTouchUIEnd(EventContext context)
|
|
{
|
|
{
|
|
@@ -277,30 +245,9 @@ namespace GFGGame
|
|
private void ControllerObjectPos()
|
|
private void ControllerObjectPos()
|
|
{
|
|
{
|
|
hitGameObj.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition - distance);
|
|
hitGameObj.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition - distance);
|
|
- if (hitGameObj.name == "BgRes")
|
|
|
|
|
|
+ if (hitGameObj.name == BgResName)
|
|
{
|
|
{
|
|
- Vector2 size = hitGameObj.GetComponent<SpriteRenderer>().size;
|
|
|
|
- Vector2 uiSize = _ui.target.size;
|
|
|
|
- float deviationWidth = (size.x - uiSize.x / 100) / 2;
|
|
|
|
- float deviationHeigh = (size.y - uiSize.y / 100) / 2;
|
|
|
|
- Vector2 pos = hitGameObj.transform.position;
|
|
|
|
- if (pos.x <= -deviationWidth)
|
|
|
|
- {
|
|
|
|
- hitGameObj.transform.position = new Vector2(-deviationWidth, hitGameObj.transform.position.y);
|
|
|
|
- }
|
|
|
|
- if (pos.x >= deviationWidth)
|
|
|
|
- {
|
|
|
|
- hitGameObj.transform.position = new Vector2(deviationWidth, hitGameObj.transform.position.y);
|
|
|
|
- }
|
|
|
|
- if (pos.y <= -deviationHeigh)
|
|
|
|
- {
|
|
|
|
- hitGameObj.transform.position = new Vector2(hitGameObj.transform.position.x, -deviationHeigh);
|
|
|
|
- }
|
|
|
|
- if (pos.y >= deviationHeigh)
|
|
|
|
- {
|
|
|
|
- hitGameObj.transform.position = new Vector2(hitGameObj.transform.position.x, deviationHeigh);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ PhotographDataManager.Instance.SetBgPos(hitGameObj, _ui.target.size);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//选中框的位置
|
|
//选中框的位置
|
|
@@ -315,7 +262,6 @@ namespace GFGGame
|
|
|
|
|
|
private void OnTouchBtnSizeBegin(EventContext context)
|
|
private void OnTouchBtnSizeBegin(EventContext context)
|
|
{
|
|
{
|
|
-
|
|
|
|
InputEvent inputEvent = (InputEvent)context.data;
|
|
InputEvent inputEvent = (InputEvent)context.data;
|
|
Vector2 screenPos = this.viewCom.GlobalToLocal(_ui.m_comSelectBox.m_btnSize.LocalToGlobal(Vector2.zero));
|
|
Vector2 screenPos = this.viewCom.GlobalToLocal(_ui.m_comSelectBox.m_btnSize.LocalToGlobal(Vector2.zero));
|
|
Vector2 pt = new Vector2(screenPos.x, screenPos.y);
|
|
Vector2 pt = new Vector2(screenPos.x, screenPos.y);
|
|
@@ -326,7 +272,6 @@ namespace GFGGame
|
|
float distance = Vector2.Distance(pt, pt2) / memoryHitGameObj.transform.localScale.x;
|
|
float distance = Vector2.Distance(pt, pt2) / memoryHitGameObj.transform.localScale.x;
|
|
_equipDistance.Add(memoryHitGameObj, distance);
|
|
_equipDistance.Add(memoryHitGameObj, distance);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
private void OnTouchBtnSizeMove(EventContext context)
|
|
private void OnTouchBtnSizeMove(EventContext context)
|
|
{
|
|
{
|
|
@@ -348,8 +293,6 @@ namespace GFGGame
|
|
float newValue = Mathf.Clamp(ss, 0.1f, 2);
|
|
float newValue = Mathf.Clamp(ss, 0.1f, 2);
|
|
ControllerScale(newValue, memoryHitGameObj);
|
|
ControllerScale(newValue, memoryHitGameObj);
|
|
|
|
|
|
- // Vector2 center = SceneController.SetGameObjectCenter(hitGameObj);
|
|
|
|
- // memoryHitGameObj.transform.position = Camera.main.ScreenToWorldPoint(center); //center;
|
|
|
|
}
|
|
}
|
|
private void OnTouchBtnSizeEnd(EventContext context)
|
|
private void OnTouchBtnSizeEnd(EventContext context)
|
|
{
|
|
{
|
|
@@ -363,7 +306,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
|
|
|
|
if (hitGameObj == null) return;
|
|
if (hitGameObj == null) return;
|
|
- if (hitGameObj.name == "BgRes") return;//背景不可以缩放、旋转
|
|
|
|
|
|
+ if (hitGameObj.name == BgResName) return;//背景不可以缩放、旋转
|
|
|
|
|
|
GTween.Kill(hitGameObj);
|
|
GTween.Kill(hitGameObj);
|
|
PinchGesture gesture = (PinchGesture)context.sender;
|
|
PinchGesture gesture = (PinchGesture)context.sender;
|
|
@@ -372,12 +315,13 @@ namespace GFGGame
|
|
|
|
|
|
ControllerScale(newValue, hitGameObj);
|
|
ControllerScale(newValue, hitGameObj);
|
|
}
|
|
}
|
|
|
|
+ //双指旋转
|
|
private void OnRotate(EventContext context)
|
|
private void OnRotate(EventContext context)
|
|
{
|
|
{
|
|
Debug.Log("双指旋转hitGameObj:" + hitGameObj);
|
|
Debug.Log("双指旋转hitGameObj:" + hitGameObj);
|
|
if (hitGameObj == null) return;
|
|
if (hitGameObj == null) return;
|
|
Debug.Log("双指旋转name:" + hitGameObj.name);
|
|
Debug.Log("双指旋转name:" + hitGameObj.name);
|
|
- if (hitGameObj.name == "BgRes") return;//背景不可以缩放、旋转
|
|
|
|
|
|
+ if (hitGameObj.name == BgResName) return;//背景不可以缩放、旋转
|
|
// isTwoTouchPoint = true;
|
|
// isTwoTouchPoint = true;
|
|
|
|
|
|
GTween.Kill(hitGameObj.transform);
|
|
GTween.Kill(hitGameObj.transform);
|
|
@@ -403,18 +347,19 @@ namespace GFGGame
|
|
|
|
|
|
private void UpdateBg(ItemCfg itemCfg)
|
|
private void UpdateBg(ItemCfg itemCfg)
|
|
{
|
|
{
|
|
- Transform tf = _sceneObject.transform.Find("Bg/BgRes");
|
|
|
|
|
|
+ Transform tf = _sceneObject.transform.Find(BgResPath);
|
|
string resPath = ResPathUtil.GetDressUpPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType));
|
|
string resPath = ResPathUtil.GetDressUpPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType));
|
|
- SceneController.UpdatePhotographBgOrNpcOrBorder(_sceneObject, itemCfg == null ? equipDataCache.bgId : itemCfg.id, tf, resPath);
|
|
|
|
|
|
+ SceneController.SetSpriteRendererToTransform(tf, resPath);
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
spr.sortingOrder = ItemTypeCfgArray.Instance.GetCfg(ConstDressUpItemType.BEI_JING).defaultLayer;
|
|
spr.sortingOrder = ItemTypeCfgArray.Instance.GetCfg(ConstDressUpItemType.BEI_JING).defaultLayer;
|
|
- SceneController.PhotographAddCollider(tf.gameObject);
|
|
|
|
|
|
+ SceneController.SetBoxCollider2DToGameObject(tf.gameObject);
|
|
}
|
|
}
|
|
//主角
|
|
//主角
|
|
private void UpdateBody()
|
|
private void UpdateBody()
|
|
{
|
|
{
|
|
- SceneController.UpdatePhotographBody(_equipRoleData.ToArray(), _sceneObject, false, null, false, bodyParent);
|
|
|
|
- int layer = _sceneObject.transform.Find("Scene/Role/Body").GetComponent<SpriteRenderer>().sortingOrder;
|
|
|
|
|
|
+ GameObject bodyParent = _sceneObject.transform.Find(RolePath).gameObject;
|
|
|
|
+ SceneController.UpdatePhotographBody(_equipRoleData.ToArray(), _sceneObject, bodyParent);
|
|
|
|
+ int layer = bodyParent.transform.Find("Body").GetComponent<SpriteRenderer>().sortingOrder;
|
|
maxLayer = layer < maxLayer ? maxLayer : layer;
|
|
maxLayer = layer < maxLayer ? maxLayer : layer;
|
|
}
|
|
}
|
|
//添加初始场景道具
|
|
//添加初始场景道具
|
|
@@ -434,21 +379,21 @@ namespace GFGGame
|
|
private void UpdateNpc(ItemCfg itemCfg)
|
|
private void UpdateNpc(ItemCfg itemCfg)
|
|
{
|
|
{
|
|
maxLayer++;
|
|
maxLayer++;
|
|
- Transform tf = _sceneObject.transform.Find("Scene/Npc/NpcRes");
|
|
|
|
|
|
+ Transform tf = _sceneObject.transform.Find(NpcResPath);
|
|
string resPath = ResPathUtil.GetNpcPicFPath(itemCfg.res);
|
|
string resPath = ResPathUtil.GetNpcPicFPath(itemCfg.res);
|
|
- SceneController.UpdatePhotographBgOrNpcOrBorder(_sceneObject, itemCfg.id, tf, resPath);
|
|
|
|
|
|
+ SceneController.SetSpriteRendererToTransform(tf, resPath);
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
spr.sortingOrder = maxLayer;
|
|
spr.sortingOrder = maxLayer;
|
|
tf.localPosition = new Vector2(-spr.bounds.center.x, -spr.bounds.center.y);
|
|
tf.localPosition = new Vector2(-spr.bounds.center.x, -spr.bounds.center.y);
|
|
- SceneController.PhotographAddCollider(tf.gameObject);
|
|
|
|
|
|
+ SceneController.SetBoxCollider2DToGameObject(tf.gameObject);
|
|
}
|
|
}
|
|
private void UpdateBorder(ItemCfg itemCfg)
|
|
private void UpdateBorder(ItemCfg itemCfg)
|
|
{
|
|
{
|
|
- Transform tf = _sceneObject.transform.Find("Border/BorderRes");
|
|
|
|
|
|
+ Transform tf = _sceneObject.transform.Find(BorderResPath);
|
|
string resPath = ResPathUtil.GetPhotographFPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType));
|
|
string resPath = ResPathUtil.GetPhotographFPath(itemCfg.res, ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType));
|
|
- SceneController.UpdatePhotographBgOrNpcOrBorder(_sceneObject, itemCfg.id, tf, resPath);
|
|
|
|
|
|
+ SceneController.SetSpriteRendererToTransform(tf, resPath);
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spr = tf.GetComponent<SpriteRenderer>();
|
|
- spr.sortingOrder = 1000;
|
|
|
|
|
|
+ spr.sortingOrder = 10000;//边框在所有道具的上边
|
|
}
|
|
}
|
|
private void UpdateEffect()
|
|
private void UpdateEffect()
|
|
{
|
|
{
|
|
@@ -473,24 +418,8 @@ namespace GFGGame
|
|
SpriteRenderer spr = parentGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spr = parentGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
|
|
|
|
ItemTypeCfg itemTypeCfg = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType);
|
|
ItemTypeCfg itemTypeCfg = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType);
|
|
- // spr.sortingOrder = isDefaultLayer ? itemTypeCfg.specialLayer : maxLayer + 1;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
int layer = isDefaultLayer ? itemTypeCfg.specialLayer : maxLayer + 1;
|
|
int layer = isDefaultLayer ? itemTypeCfg.specialLayer : maxLayer + 1;
|
|
- for (int i = 0; i < parentGameObj.transform.childCount; i++)
|
|
|
|
- {
|
|
|
|
- Transform obj = parentGameObj.transform.GetChild(i);
|
|
|
|
- string[] strs = obj.name.Split('_');
|
|
|
|
- if (strs.Length > 1 && strs[1] == "eff")
|
|
|
|
- {
|
|
|
|
- DressUpUtil.SetParticleSortingOrder(obj.gameObject, layer);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- obj.GetComponent<SpriteRenderer>().sortingOrder = layer;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ PhotographDataManager.Instance.SetItemLayer(parentGameObj, layer);
|
|
maxLayer = layer;
|
|
maxLayer = layer;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -505,47 +434,19 @@ namespace GFGGame
|
|
parentGameObj = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, index, 0));
|
|
parentGameObj = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, index, 0));
|
|
SceneController.AddItemToScene(_sceneObject, parentGameObj, itemCfg.id, itemCfg.resLayer1);
|
|
SceneController.AddItemToScene(_sceneObject, parentGameObj, itemCfg.id, itemCfg.resLayer1);
|
|
SpriteRenderer spr = parentGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spr = parentGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
- ItemTypeCfg itemTypeCfg = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType);
|
|
|
|
|
|
|
|
|
|
+ ItemTypeCfg itemTypeCfg = ItemTypeCfgArray.Instance.GetCfg(itemCfg.subType);
|
|
int layer = isDefaultLayer ? itemTypeCfg.defaultLayer : maxLayer + 1;
|
|
int layer = isDefaultLayer ? itemTypeCfg.defaultLayer : maxLayer + 1;
|
|
- for (int i = 0; i < parentGameObj.transform.childCount; i++)
|
|
|
|
- {
|
|
|
|
- Transform obj = parentGameObj.transform.GetChild(i);
|
|
|
|
- string[] strs = obj.name.Split('_');
|
|
|
|
- if (strs.Length > 1 && strs[1] == "eff")
|
|
|
|
- {
|
|
|
|
- DressUpUtil.SetParticleSortingOrder(obj.gameObject, layer);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- obj.GetComponent<SpriteRenderer>().sortingOrder = layer;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ PhotographDataManager.Instance.SetItemLayer(parentGameObj, layer);
|
|
maxLayer = layer;
|
|
maxLayer = layer;
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- private void DisposeEquipData()
|
|
|
|
- {
|
|
|
|
- for (int i = 0; i < equipDataCache.equipDatas.Length; i++)
|
|
|
|
- {
|
|
|
|
- ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(equipDataCache.equipDatas[i]);
|
|
|
|
- if (itemCfg.subType == ConstDressUpItemType.QIAN_JING || itemCfg.subType == ConstDressUpItemType.BEI_SHI || itemCfg.subType == ConstDressUpItemType.HUAN_JING)
|
|
|
|
- {
|
|
|
|
- PhotographDataManager.Instance.AddEquipItem(_equipSceneData, itemCfg.id, out _equipSceneData);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- _equipRoleData.Add(equipDataCache.equipDatas[i]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
private void OnClickBtnBg()
|
|
private void OnClickBtnBg()
|
|
{
|
|
{
|
|
@@ -566,11 +467,11 @@ namespace GFGGame
|
|
|
|
|
|
private void OnTouchBtnDeleteBegin()//删除
|
|
private void OnTouchBtnDeleteBegin()//删除
|
|
{
|
|
{
|
|
- if (memoryHitGameObj.transform.gameObject == bodyParent)
|
|
|
|
|
|
+ if (memoryHitGameObj.transform.name == RolePath)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- else if (memoryHitGameObj.transform.gameObject == npcParent)
|
|
|
|
|
|
+ else if (memoryHitGameObj.transform.name == NpcPath)
|
|
{
|
|
{
|
|
SpriteRenderer spriteRenderer = memoryHitGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
SpriteRenderer spriteRenderer = memoryHitGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
if (spriteRenderer != null)
|
|
if (spriteRenderer != null)
|
|
@@ -589,7 +490,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
- private void OnClickBtnChoose()
|
|
|
|
|
|
+ private void SetUIView()
|
|
{
|
|
{
|
|
_ui.m_ComSelectRes.target.visible = true;
|
|
_ui.m_ComSelectRes.target.visible = true;
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
@@ -629,7 +530,7 @@ namespace GFGGame
|
|
GameObject.Destroy(_sceneObject);
|
|
GameObject.Destroy(_sceneObject);
|
|
_sceneObject = null;
|
|
_sceneObject = null;
|
|
}
|
|
}
|
|
- equipDataCache = null;
|
|
|
|
|
|
+ // equipDataCache = null;
|
|
_equipRoleData.Clear();
|
|
_equipRoleData.Clear();
|
|
_equipSceneData.Clear();
|
|
_equipSceneData.Clear();
|
|
hitGameObj = null;
|
|
hitGameObj = null;
|