123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityGameFramework.Runtime;
- using GameFramework;
- using GameFramework.DataTable;
- using GameFramework.Sound;
- using GameFramework.Download;
- using GameFramework.FileSystem;
- using GameFramework.ObjectPool;
- using GameFramework.Resource;
- using System;
- namespace MetaClient
- {
- public class UICustom : UGuiForm
- {
- // Start is called before the first frame update
- [Header("初始界面")]
- public GameObject toolView;
- [Header("基础按钮界面")]
- public GameObject baseView;
- [Header("保存按钮")]
- public GameObject saveBtn;
- [Header("捏脸界面")]
- public GameObject nieLianView;
- [Header("身体界面")]
- public GameObject bodyView;
- [Header("衣服界面")]
- public GameObject clothView;
- //[Header("点击后生成的按钮列表")]
- //public GameObject buttonList;
- [Header("按钮预制体")]
- public GameObject buttonItem;
- [Header("颜色演示预制体")]
- public GameObject colItem;
- private float tween_leftMax = -100;
- private float tween_leftMix = 73.3f;
- private float tween_rightMin = 375f;
- private float tween_rightMax = 536f;
- private float tween_saveBtnMax = 119;
- private float tween_saveBtnMin = -108;
- //private float tweenTime = 10;
- //private float tweenLeastTime = 0;
- private bool isTween = false;
- [Header("选择界面分支")]
- [SerializeField]
- private ECustomStyple eCustomStyple = ECustomStyple.None;
- [Header("历史记录用于回退")]
- [SerializeField]
- private List<string> histroy;
- protected override void OnOpen(object userData)
- {
- base.OnOpen(userData);
- //IDataTable<DRCustomRole> _data = GameEntry.DataTable.GetDataTable<DRCustomRole>();
- }
- protected override void OnClose(bool isShutdown, object userData)
- {
- base.OnClose(isShutdown, userData);
- }
- public void ClickBtnFun(object[] _objects) {
- if (isTween)
- {
- return;
- }
- ECustomStyple _eCustomStyple = (ECustomStyple)int.Parse(_objects[0].ToString());
- switch (eCustomStyple)
- {
- case ECustomStyple.None:
- break;
- case ECustomStyple.NieLian:
- GameObject _nieLianList = nieLianView.transform.GetChild(0).gameObject;
- _nieLianList.SetActive(false);
- GameObject _nieLianXX = nieLianView.transform.GetChild(2).gameObject;
- break;
- case ECustomStyple.Body:
- break;
- case ECustomStyple.Cloth:
- break;
- }
- }
-
- //private IEnumerator Tween(Action _action) {
- // for (int i = 0; i < 100; i++)
- // {
- // float _value = i / 100;
- // float _right=Mathf.Lerp(tween_rightMax, tween_rightMin, _value);
- // float _left= Mathf.Lerp(tween_leftMix, tween_rightMax, _value);
- // clothView.GetComponent<RectTransform>().SetPositionX(_right);
- // toolView.GetComponent<RectTransform>().SetPositionX(_right);
- // bodyView.GetComponent<RectTransform>().SetPositionX(_right);
- // nieLianView.GetComponent<RectTransform>().SetPositionX(_right);
- // baseView.GetComponent<RectTransform>().SetPositionX(_left);
- // }
- // yield return null;
- //}
- protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
- {
- 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 CreateButtonFun(string path,GameObject _parent,Action action) {
- GameEntry.Resource.LoadAsset(AssetUtility.GetUISpriteAsset(path), new LoadAssetCallbacks(
- (assetName, asset, duration, userData) =>
- {
- 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>();
- _objImg.sprite = sprite;
- _obj.transform.SetParent(_parent.transform);
- //GameObject
- //img.sprite = sprite;
- //if (nativeSize)
- //{
- // img.SetNativeSize();
- //}
- }));
- }
- //public void NieLian() {
-
- //}
- public void ClickFaceChangeBtn()
- {
- GameEntry.Event.Fire(this, CustomRoleFaceEventArgs.Create(EditableFacePart.eye, new Vector3(1, 0, 0)));
- }
- }
- public enum ECustomStyple
- {
- None,
- NieLian,
- Body,
- Cloth
- }
- public enum EButtonStyple
- {
- Button,
- Scroll,
- TiaoSe,
- NorButton,
- }
- public enum ENieLianStyple {
- faxing,
- lianxing,
- yankuang,
- tongkong,
- meimao,
- bizi,
- erduo,
- zuiba,
- fuse
- }
- }
|