|
@@ -11,6 +11,7 @@ using GameFramework.FileSystem;
|
|
|
using GameFramework.ObjectPool;
|
|
|
using GameFramework.Resource;
|
|
|
using System;
|
|
|
+using DG.Tweening;
|
|
|
namespace MetaClient
|
|
|
{
|
|
|
|
|
@@ -36,22 +37,31 @@ namespace MetaClient
|
|
|
[Header("衣服界面")]
|
|
|
public GameObject clothView;
|
|
|
|
|
|
+ [Header("左边界面")]
|
|
|
+ public GameObject leftView;
|
|
|
+
|
|
|
+ [Header("右边界面")]
|
|
|
+ public GameObject rightView;
|
|
|
+
|
|
|
//[Header("点击后生成的按钮列表")]
|
|
|
//public GameObject buttonList;
|
|
|
|
|
|
[Header("按钮预制体")]
|
|
|
public GameObject buttonItem;
|
|
|
|
|
|
+ [Header("滑块")]
|
|
|
+ public Scrollbar scrollbar;
|
|
|
+
|
|
|
|
|
|
[Header("颜色演示预制体")]
|
|
|
public GameObject colItem;
|
|
|
|
|
|
|
|
|
- private float tween_leftMax = -100;
|
|
|
- private float tween_leftMix = 73.3f;
|
|
|
+ public float tween_leftMax = 0;
|
|
|
+ public float tween_leftMin = -250;
|
|
|
|
|
|
- private float tween_rightMin = 375f;
|
|
|
- private float tween_rightMax = 536f;
|
|
|
+ public float tween_rightMin = 0;
|
|
|
+ public float tween_rightMax = 223;
|
|
|
|
|
|
private float tween_saveBtnMax = 119;
|
|
|
private float tween_saveBtnMin = -108;
|
|
@@ -60,31 +70,97 @@ namespace MetaClient
|
|
|
//private float tweenTime = 10;
|
|
|
//private float tweenLeastTime = 0;
|
|
|
|
|
|
- private bool isTween = false;
|
|
|
+ public bool isTween = false;
|
|
|
[Header("选择界面分支")]
|
|
|
[SerializeField]
|
|
|
private ECustomStyple eCustomStyple = ECustomStyple.None;
|
|
|
[Header("历史记录用于回退")]
|
|
|
[SerializeField]
|
|
|
private List<string> histroy;
|
|
|
+
|
|
|
+ private int part = 0;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
+ //[Header("接受到的数据")]
|
|
|
+ //[SerializeField]
|
|
|
+ private IDataTable<DRCustomBody> _bodydata;
|
|
|
protected override void OnOpen(object userData)
|
|
|
{
|
|
|
|
|
|
base.OnOpen(userData);
|
|
|
- //IDataTable<DRCustomRole> _data = GameEntry.DataTable.GetDataTable<DRCustomRole>();
|
|
|
+ IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
|
|
|
+ _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
|
|
|
+
|
|
|
}
|
|
|
protected override void OnClose(bool isShutdown, object userData)
|
|
|
{
|
|
|
base.OnClose(isShutdown, userData);
|
|
|
}
|
|
|
- public void ClickBtnFun(object[] _objects) {
|
|
|
+
|
|
|
+
|
|
|
+ public void ClickBotton(ECustomStyple eCustomStyple,int id)
|
|
|
+ {
|
|
|
if (isTween)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- ECustomStyple _eCustomStyple = (ECustomStyple)int.Parse(_objects[0].ToString());
|
|
|
+ isTween = true;
|
|
|
+ leftView.transform.DOLocalMoveX(tween_leftMin, 2f).SetEase(Ease.InOutBack).OnComplete(()=> {
|
|
|
+ ClickBtnFun(eCustomStyple,id);
|
|
|
+ leftView.transform.DOLocalMoveX(0, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
|
|
|
+ isTween = false;
|
|
|
+ Debug.Log("222");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ Debug.Log("333");
|
|
|
+ rightView.transform.DOLocalMoveX(tween_rightMax, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
|
|
|
+ rightView.transform.DOLocalMoveX(0, 2f).SetEase(Ease.InOutBack).OnComplete(() => {
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 滑块改变
|
|
|
+ /// </summary>
|
|
|
+ public void ScrollValueChange()
|
|
|
+ {
|
|
|
+ Debug.Log(scrollbar.value);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 修改滑块
|
|
|
+ /// </summary>
|
|
|
+
|
|
|
+ public void SetValue(int _part,ECustomStyple eCustomStyple)
|
|
|
+ {
|
|
|
+
|
|
|
+ //scrollbar.value = _value;
|
|
|
+ part = _part;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获得滑块值
|
|
|
+ /// </summary>
|
|
|
+ public float GetValue()
|
|
|
+ {
|
|
|
+ return scrollbar.value;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 按钮点击事件
|
|
|
+ /// </summary>
|
|
|
+ public void ClickBtnFun(ECustomStyple eCustomStyple,int id) {
|
|
|
+ //if (isTween)
|
|
|
+ //{
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //ECustomStyple _eCustomStyple = (ECustomStyple)int.Parse(_objects[0].ToString());
|
|
|
switch (eCustomStyple)
|
|
|
{
|
|
|
case ECustomStyple.None:
|
|
@@ -93,14 +169,65 @@ namespace MetaClient
|
|
|
GameObject _nieLianList = nieLianView.transform.GetChild(0).gameObject;
|
|
|
_nieLianList.SetActive(false);
|
|
|
GameObject _nieLianXX = nieLianView.transform.GetChild(2).gameObject;
|
|
|
+ _nieLianXX.SetActive(true);
|
|
|
+ CreateBodyImg(id);
|
|
|
break;
|
|
|
case ECustomStyple.Body:
|
|
|
+ GameObject _bodyList = bodyView.transform.GetChild(0).gameObject;
|
|
|
+ _bodyList.SetActive(false);
|
|
|
+ GameObject _bodyListXX =bodyView.transform.GetChild(2).gameObject;
|
|
|
+ _bodyListXX.SetActive(true);
|
|
|
+ CreateBodyImg(id);
|
|
|
break;
|
|
|
case ECustomStyple.Cloth:
|
|
|
+ GameObject _clothList = clothView.transform.GetChild(0).gameObject;
|
|
|
+ _clothList.SetActive(false);
|
|
|
+ GameObject _clothListXX = clothView.transform.GetChild(2).gameObject;
|
|
|
+ _clothListXX.SetActive(true);
|
|
|
+ CreateBodyImg(id);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //public Action ActionFun() {
|
|
|
+
|
|
|
+ // return null;
|
|
|
+ //}
|
|
|
+
|
|
|
+ private void RemoveAllChildren(GameObject parent)
|
|
|
+ {
|
|
|
+ Transform transform;
|
|
|
+ for (int i = 0; i < parent.transform.childCount; i++)
|
|
|
+ {
|
|
|
+ transform = parent.transform.GetChild(i);
|
|
|
+ GameObject.Destroy(transform.gameObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void CreateBodyImg(int parentid) {
|
|
|
+ RemoveAllChildren(bodyView.transform.GetChild(2).GetChild(0).gameObject);
|
|
|
+ IDataTable<DRCustomBody> _data = GameEntry.DataTable.GetDataTable<DRCustomBody>();
|
|
|
+ _bodydata = GameEntry.DataTable.GetDataTable<DRCustomBody>();
|
|
|
+
|
|
|
+ DRCustomBody[] dRCustomBodies = _bodydata.GetAllDataRows();
|
|
|
+ for (int i = 0; i < dRCustomBodies.Length; i++)
|
|
|
+ {
|
|
|
+ Debug.Log(dRCustomBodies[i].Id);
|
|
|
+ if (dRCustomBodies[i].ParentStyple == parentid)
|
|
|
+ {
|
|
|
+ CreateButtonFun(dRCustomBodies[i].Icon, dRCustomBodies[i].Part, dRCustomBodies[i].Name, bodyView.transform.GetChild(2).GetChild(0).gameObject, dRCustomBodies[i].Id, dRCustomBodies[i].ButtonStyple, ECustomStyple.Body);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//private IEnumerator Tween(Action _action) {
|
|
|
// for (int i = 0; i < 100; i++)
|
|
|
// {
|
|
@@ -128,48 +255,62 @@ namespace MetaClient
|
|
|
base.OnUpdate(elapseSeconds, realElapseSeconds);
|
|
|
}
|
|
|
|
|
|
- private void CreateNieLianFun(object[] _objects) {
|
|
|
- ENieLianStyple _eNieLianStyple = (ENieLianStyple)int.Parse(_objects[1].ToString());
|
|
|
- switch (_eNieLianStyple)
|
|
|
- {
|
|
|
- case ENieLianStyple.faxing:
|
|
|
- break;
|
|
|
- case ENieLianStyple.lianxing:
|
|
|
- break;
|
|
|
- case ENieLianStyple.yankuang:
|
|
|
- break;
|
|
|
- case ENieLianStyple.tongkong:
|
|
|
- break;
|
|
|
- case ENieLianStyple.meimao:
|
|
|
- break;
|
|
|
- case ENieLianStyple.bizi:
|
|
|
- break;
|
|
|
- case ENieLianStyple.erduo:
|
|
|
- break;
|
|
|
- case ENieLianStyple.zuiba:
|
|
|
- break;
|
|
|
- case ENieLianStyple.fuse:
|
|
|
- break;
|
|
|
- }
|
|
|
- //switch()
|
|
|
- }
|
|
|
+ //private void CreateNieLianFun(object[] _objects) {
|
|
|
+ // ENieLianStyple _eNieLianStyple = (ENieLianStyple)int.Parse(_objects[1].ToString());
|
|
|
+ // switch (_eNieLianStyple)
|
|
|
+ // {
|
|
|
+ // case ENieLianStyple.faxing:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.lianxing:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.yankuang:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.tongkong:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.meimao:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.bizi:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.erduo:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.zuiba:
|
|
|
+ // break;
|
|
|
+ // case ENieLianStyple.fuse:
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // //switch()
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- private void CreateButtonFun(string path,GameObject _parent,Action action) {
|
|
|
+ private void CreateButtonFun(string path,int _part,string _name, GameObject _parent,int _id,int buttonstyple,ECustomStyple eCustomStyple) {
|
|
|
+ //Debug.Log(path);
|
|
|
+ // Debug.Log(_parent);
|
|
|
+ path = "CustomRole/" + path;
|
|
|
GameEntry.Resource.LoadAsset(AssetUtility.GetUISpriteAsset(path), new LoadAssetCallbacks(
|
|
|
(assetName, asset, duration, userData) =>
|
|
|
{
|
|
|
+ // Debug.Log(path);
|
|
|
+ // Debug.Log(_parent);
|
|
|
+
|
|
|
Texture2D tex = (Texture2D)asset;
|
|
|
var sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero);
|
|
|
GameObject _obj = GameObject.Instantiate(buttonItem);
|
|
|
Image _objImg = _obj.transform.GetComponent<Image>();
|
|
|
+ _obj.SetActive(true);
|
|
|
_objImg.sprite = sprite;
|
|
|
+ _obj.name = part+"";
|
|
|
_obj.transform.SetParent(_parent.transform);
|
|
|
-
|
|
|
+ UICustomBtn uICustomBtn = _obj.GetComponent<UICustomBtn>();
|
|
|
+ uICustomBtn.id = _id;
|
|
|
+ uICustomBtn.eButtonStyple = (EButtonStyple)buttonstyple;
|
|
|
+ uICustomBtn.eCustomStyple = eCustomStyple;
|
|
|
+ uICustomBtn.isCreate = false;
|
|
|
+ uICustomBtn.part = _part;
|
|
|
+
|
|
|
//GameObject
|
|
|
//img.sprite = sprite;
|
|
|
//if (nativeSize)
|
|
@@ -205,6 +346,7 @@ namespace MetaClient
|
|
|
NorButton,
|
|
|
}
|
|
|
public enum ENieLianStyple {
|
|
|
+ None,
|
|
|
faxing,
|
|
|
lianxing,
|
|
|
yankuang,
|