|
@@ -20,12 +20,12 @@ namespace GFGGame
|
|
|
private const int MAX_COUNT = 8;
|
|
|
private const float MaxScale = 2;
|
|
|
private const float MinScale = 0.1f;
|
|
|
- private const string BgResPath = "Bg/BgRes";
|
|
|
- private const string BorderResPath = "Border/BorderRes";
|
|
|
- private const string NpcResPath = "Scene/Npc/NpcRes";
|
|
|
+ // 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 RoleName = "Role";
|
|
|
- private const string NpcPath = "Scene/Npc";
|
|
|
+ private const string BodyResName = "BodyRes";
|
|
|
+ // private const string NpcPath = "Scene/Npc";
|
|
|
private const string NpcName = "Npc";
|
|
|
private const string BgResName = "BgRes";
|
|
|
private const string Border = "Border";
|
|
@@ -96,7 +96,7 @@ namespace GFGGame
|
|
|
_ui.m_comSelectBox.m_btnSize.onTouchEnd.Add(OnTouchBtnSizeEnd);
|
|
|
|
|
|
_ui.m_comSelectBox.m_btnFlip.onTouchBegin.Add(OnTouchBtnFlipBegin);
|
|
|
- _ui.m_comSelectBox.m_btnFlip.onTouchEnd.Add(OnTouchBtnFlipEnd);
|
|
|
+ // _ui.m_comSelectBox.m_btnFlip.onTouchEnd.Add(OnTouchBtnFlipEnd);
|
|
|
|
|
|
_ui.m_comSelectBox.m_btnDelete.onTouchBegin.Add(OnTouchBtnDeleteBegin);
|
|
|
|
|
@@ -139,7 +139,7 @@ namespace GFGGame
|
|
|
PhotographSceneManager.Instance.AddBgItem(ItemCfgArray.Instance.GetCfg(MyDressUpHelper.dressUpObj.bgId));
|
|
|
PhotographSceneManager.Instance.AddBodyItem();
|
|
|
UpdateScene();
|
|
|
- PhotographDataManager.Instance.SetLayer(null, "refresh");
|
|
|
+ PhotographUtil.Instance.SetLayer(null, "refresh");
|
|
|
|
|
|
_ui.m_txtCount.text = string.Format("{0}/{1}", PoemGalleryDataManager.Instance.MyWorksCountOfTheme, GlobalCfgArray.globalCfg.maxGalleryWorksCount);
|
|
|
|
|
@@ -230,9 +230,11 @@ namespace GFGGame
|
|
|
|
|
|
private void AddSceneItem(ItemCfg itemCfg, bool setLayer)
|
|
|
{
|
|
|
+ bool isOnlyEff = true;
|
|
|
Vector3 pos = Vector3.zero;
|
|
|
if (!string.IsNullOrEmpty(itemCfg.resLayer3))
|
|
|
{
|
|
|
+ isOnlyEff = false;
|
|
|
GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 3));
|
|
|
PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer);
|
|
|
if (setLayer)
|
|
@@ -243,23 +245,36 @@ namespace GFGGame
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(itemCfg.resLayer2))
|
|
|
{
|
|
|
+ isOnlyEff = false;
|
|
|
GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 2));
|
|
|
PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer);
|
|
|
if (setLayer)
|
|
|
{
|
|
|
parentGameObj2.transform.localPosition = pos == Vector3.zero ? -parentGameObj2.transform.GetChild(0).localPosition : pos;
|
|
|
- // parentGameObj2.transform.localPosition = -parentGameObj2.transform.GetChild(0).localPosition;
|
|
|
pos = parentGameObj2.transform.localPosition;
|
|
|
}
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(itemCfg.resLayer1))
|
|
|
{
|
|
|
+ isOnlyEff = false;
|
|
|
GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}", itemCfg.id, 1));
|
|
|
PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer);
|
|
|
|
|
|
if (setLayer)
|
|
|
{
|
|
|
parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos;
|
|
|
+ pos = parentGameObj1.transform.localPosition;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isOnlyEff && itemCfg.effLayer > 0)
|
|
|
+ {
|
|
|
+ GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}", itemCfg.id, "eff"));
|
|
|
+ PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 0, setLayer, true);
|
|
|
+
|
|
|
+ if (setLayer)
|
|
|
+ {
|
|
|
+ parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -271,7 +286,7 @@ namespace GFGGame
|
|
|
context.CaptureTouch();
|
|
|
if (_ui.m_ComSelectRes.target.visible == true) return;//添加道具不监听场景点击
|
|
|
if (Stage.inst.touchCount > 1 && hitGameObj != null || Stage.inst.touchCount == 1 && context.inputEvent.touchId != 0) return;//两根手指&&两指不是同时按下||一根手指但属于中途换指
|
|
|
- if (PhotographDataManager.Instance.IsTouchUI(this.viewCom)) return;
|
|
|
+ if (PhotographUtil.Instance.IsTouchUI(this.viewCom)) return;
|
|
|
|
|
|
RaycastHit2D[] hit2Ds = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
|
|
|
if (hit2Ds.Length > 0)
|
|
@@ -279,10 +294,10 @@ namespace GFGGame
|
|
|
|
|
|
lastPos = Vector2.zero;
|
|
|
|
|
|
- hitGameObj = SceneController.GetFirstHitObj(hit2Ds);
|
|
|
+ hitGameObj = PhotographUtil.Instance.GetFirstHitObj(hit2Ds);
|
|
|
|
|
|
_ui.m_comSelectBox.m_btnDelete.visible = true;
|
|
|
- if (hitGameObj.name == "Body")//主角不可删除
|
|
|
+ if (hitGameObj.name == BodyResName)//主角不可删除
|
|
|
{
|
|
|
_ui.m_comSelectBox.m_btnDelete.visible = false;
|
|
|
}
|
|
@@ -294,12 +309,12 @@ namespace GFGGame
|
|
|
_ui.m_comSelectBox.target.visible = true;
|
|
|
if (hitGameObj.name != Border)
|
|
|
{
|
|
|
- PhotographDataManager.Instance.SetLayer(hitGameObj, "top");
|
|
|
+ PhotographUtil.Instance.SetLayer(hitGameObj, "top");
|
|
|
}
|
|
|
|
|
|
if (!_equipDistance.ContainsKey(hitGameObj))
|
|
|
{
|
|
|
- SceneController.SetGameObjectCenter(hitGameObj);
|
|
|
+ PhotographUtil.Instance.SetGameObjectCenter(hitGameObj);
|
|
|
}
|
|
|
}
|
|
|
memoryHitGameObj = hitGameObj;
|
|
@@ -324,8 +339,7 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
_ui.m_comSelectBox.target.rotation = rotation;
|
|
|
- Debug.Log("rotation:" + _ui.m_comSelectBox.target.rotation + " " + _ui.m_comSelectBox.target.rotationX + " " + _ui.m_comSelectBox.target.rotationY);
|
|
|
- _ui.m_comSelectBox.target.size = SceneController.GetGameObjectSize(hitGameObj);
|
|
|
+ _ui.m_comSelectBox.target.size = PhotographUtil.Instance.GetGameObjectBoxSize(hitGameObj);
|
|
|
ControllerSelectBoxPos();
|
|
|
|
|
|
}
|
|
@@ -335,9 +349,8 @@ namespace GFGGame
|
|
|
{
|
|
|
if (hitGameObj == null) return;//未选中任何物体
|
|
|
if (Stage.inst.touchCount > 1) return; //只监听1根手指
|
|
|
- if (PhotographDataManager.Instance.IsTouchUI(this.viewCom)) return;
|
|
|
+ if (PhotographUtil.Instance.IsTouchUI(this.viewCom)) return;
|
|
|
|
|
|
- Debug.Log("拖动");
|
|
|
ControllerObjectPos();
|
|
|
ControllerSelectBoxPos();
|
|
|
}
|
|
@@ -353,7 +366,7 @@ namespace GFGGame
|
|
|
hitGameObj.transform.position = Camera.main.ScreenToWorldPoint(Input.mousePosition - distance);
|
|
|
if (hitGameObj.name == BgResName)
|
|
|
{
|
|
|
- PhotographDataManager.Instance.SetBgPos(hitGameObj, _ui.target.size);
|
|
|
+ PhotographUtil.Instance.SetBgPos(hitGameObj, _ui.target.size);
|
|
|
}
|
|
|
}
|
|
|
//选中框的位置
|
|
@@ -387,8 +400,8 @@ namespace GFGGame
|
|
|
if (memoryHitGameObj == null) return;
|
|
|
InputEvent inputEvent = (InputEvent)context.data;
|
|
|
|
|
|
- Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
|
|
|
- Vector2 pt2 = new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y);
|
|
|
+ Vector2 pt1 = this.viewCom.GlobalToLocal(inputEvent.position);
|
|
|
+ Vector2 pt2 = _ui.m_comSelectBox.target.xy;
|
|
|
Vector2 curPos = pt1 - pt2;
|
|
|
|
|
|
float angle = Vector3.Angle(lastPos, curPos); //求出两向量之间的夹角
|
|
@@ -398,20 +411,20 @@ namespace GFGGame
|
|
|
ControllerRotate(angle, memoryHitGameObj);
|
|
|
|
|
|
float dist = Vector2.Distance(pt1, pt2);
|
|
|
-
|
|
|
float ss = dist / lastDistance;
|
|
|
- Debug.Log("dist:" + dist + " lastDistance:" + lastDistance + " ss:" + ss);
|
|
|
- float newValue = Mathf.Clamp(ss * memoryHitGameObj.transform.localScale.x, 0.1f, 2);
|
|
|
- ControllerScale(newValue, memoryHitGameObj);
|
|
|
-
|
|
|
- if (newValue <= 0.1f) return;
|
|
|
- Debug.Log("ss:" + ss + " newValue:" + newValue);
|
|
|
- lastDistance = dist;
|
|
|
- Debug.Log("newValue:" + newValue);
|
|
|
-
|
|
|
-
|
|
|
+ float curValue = Math.Abs(memoryHitGameObj.transform.localScale.x);
|
|
|
+ float newValue = Mathf.Clamp(ss * curValue, 0.1f, 2);
|
|
|
|
|
|
+ ControllerScale(newValue, memoryHitGameObj, Math.Sign(memoryHitGameObj.transform.localScale.x));
|
|
|
|
|
|
+ if (newValue <= 0.1f)
|
|
|
+ {
|
|
|
+ lastDistance = Vector2.Distance(_ui.m_comSelectBox.m_btnDelete.xy, _ui.m_comSelectBox.m_btnSize.xy) / 2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lastDistance = dist;
|
|
|
+ }
|
|
|
}
|
|
|
private void OnTouchBtnSizeEnd(EventContext context)
|
|
|
{
|
|
@@ -432,7 +445,7 @@ namespace GFGGame
|
|
|
float newValue = Mathf.Clamp(hitGameObj.transform.localScale.x + gesture.delta, 0.3f, 2);
|
|
|
Debug.Log("双指缩放:" + newValue);
|
|
|
|
|
|
- ControllerScale(newValue, hitGameObj);
|
|
|
+ ControllerScale(newValue, hitGameObj, Math.Sign(hitGameObj.transform.localScale.x));
|
|
|
}
|
|
|
//双指旋转
|
|
|
private void OnRotate(EventContext context)
|
|
@@ -450,11 +463,11 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void ControllerScale(float value, GameObject gameObject)
|
|
|
+ private void ControllerScale(float value, GameObject gameObject, int sign)
|
|
|
{
|
|
|
if (value > MaxScale || value < MinScale) return;
|
|
|
- gameObject.transform.localScale = new Vector3(value, value, 1);
|
|
|
- Vector2 size = SceneController.GetGameObjectSize(gameObject);
|
|
|
+ gameObject.transform.localScale = new Vector3(value * sign, value, value);
|
|
|
+ Vector2 size = PhotographUtil.Instance.GetGameObjectBoxSize(gameObject);
|
|
|
_ui.m_comSelectBox.target.size = size;
|
|
|
}
|
|
|
private void ControllerRotate(float value, GameObject gameObject)
|
|
@@ -472,21 +485,10 @@ namespace GFGGame
|
|
|
private void OnTouchBtnFlipBegin()//翻转
|
|
|
{
|
|
|
Transform transform = memoryHitGameObj.transform;
|
|
|
- if (memoryHitGameObj.name == RoleName)
|
|
|
- {
|
|
|
- //transform.Rotate(Vector3.up, 180, Space.Self);
|
|
|
- var newValue = -transform.localScale.x;
|
|
|
- transform.localScale = new Vector3(newValue, transform.localScale.y, transform.localScale.z);
|
|
|
- return;
|
|
|
- }
|
|
|
- for (int i = 0; i < transform.childCount; i++)
|
|
|
- {
|
|
|
- //transform.GetChild(i).Rotate(Vector3.up, 180, Space.Self);
|
|
|
- }
|
|
|
- }
|
|
|
- private void OnTouchBtnFlipEnd()
|
|
|
- {
|
|
|
+ var value = Math.Abs(transform.localScale.x);
|
|
|
+ // transform.localScale = new Vector3(-value, Math.Abs(value), 1);
|
|
|
|
|
|
+ ControllerScale(value, memoryHitGameObj, -Math.Sign(transform.localScale.x));
|
|
|
}
|
|
|
|
|
|
private void OnTouchBtnDeleteBegin()//删除
|
|
@@ -495,17 +497,14 @@ namespace GFGGame
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- else if (memoryHitGameObj.transform.name == Border)
|
|
|
+ else if (memoryHitGameObj.transform.name == Border || memoryHitGameObj.transform.name == NpcName)
|
|
|
{
|
|
|
- ChangeItem(ConstItemID.BORDERID);
|
|
|
- }
|
|
|
- else if (memoryHitGameObj.transform.name == NpcName)
|
|
|
- {
|
|
|
- SpriteRenderer spriteRenderer = memoryHitGameObj.transform.GetChild(0).GetComponent<SpriteRenderer>();
|
|
|
- if (spriteRenderer != null)
|
|
|
- {
|
|
|
- GameObject.Destroy(spriteRenderer);
|
|
|
- }
|
|
|
+ memoryHitGameObj.transform.localPosition = Vector3.zero;
|
|
|
+ memoryHitGameObj.transform.localRotation = Quaternion.Euler(Vector3.zero);
|
|
|
+ memoryHitGameObj.transform.localScale = Vector3.one;
|
|
|
+ GameObject gameObject = memoryHitGameObj.transform.GetChild(0).gameObject;
|
|
|
+ PhotographSceneManager.Instance.DeleteSpriteRendererFromGameObject(gameObject);
|
|
|
+ PhotographSceneManager.Instance.DeleteBoxCollider2DFromGameObject(gameObject);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -533,11 +532,11 @@ namespace GFGGame
|
|
|
private void OnClickBtnUp()
|
|
|
{
|
|
|
|
|
|
- PhotographDataManager.Instance.SetLayer(memoryHitGameObj, "up");
|
|
|
+ PhotographUtil.Instance.SetLayer(memoryHitGameObj, "up");
|
|
|
}
|
|
|
private void OnClickBtnDown()
|
|
|
{
|
|
|
- PhotographDataManager.Instance.SetLayer(memoryHitGameObj, "down");
|
|
|
+ PhotographUtil.Instance.SetLayer(memoryHitGameObj, "down");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -583,20 +582,10 @@ namespace GFGGame
|
|
|
bool pushResult = await PictureStorageHelper.PushToHWCloud(rsp[0].ToString(), bytes);
|
|
|
if (!pushResult) return;
|
|
|
|
|
|
- bool result = await PoemGallerySProxy.ReqNoticeGalleryWorksUploaded((long)(rsp[1]));
|
|
|
+ bool result = await PoemGallerySProxy.ReqNoticeGalleryWorksUploaded((long)(rsp[1]), tex);
|
|
|
if (result)
|
|
|
{
|
|
|
- PoemGalleryData galleryData = new PoemGalleryData();
|
|
|
- galleryData.WorkId = (long)rsp[1];
|
|
|
- galleryData.Rank = 0;
|
|
|
- galleryData.AuthorId = RoleDataManager.roleId;
|
|
|
- galleryData.AuthorName = RoleDataManager.roleName;
|
|
|
- galleryData.CreateTime = TimeHelper.ServerNow();
|
|
|
- galleryData.ThemeOrder = PoemGalleryDataManager.Instance.ThemeOrder;
|
|
|
- galleryData.ThemeId = PoemGalleryDataManager.Instance.ThemeId;
|
|
|
- galleryData.Ntexture = new NTexture(tex);
|
|
|
- PoemGalleryDataManager.Instance.UpdateGalleryData(galleryData);
|
|
|
- PoemGalleryDataManager.Instance.MySelfDatas.Insert(0, galleryData.WorkId);
|
|
|
+
|
|
|
_ui.m_txtCount.text = string.Format("{0}/{1}", PoemGalleryDataManager.Instance.MyWorksCountOfTheme, GlobalCfgArray.globalCfg.maxGalleryWorksCount);
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
OnClickBtnBack();
|