123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using UnityEngine;
- using UnityEngine.UI;
- using GameFramework;
- using GameFramework.DataTable;
- using GameFramework.Resource;
- namespace MetaClient
- {
- public class UIAnimationMaker : UGuiForm
- {
- [SerializeField]
- [Header("模式类型")]
- protected EUIAnimationMakerStyple eUIAnimationMakerStyple = EUIAnimationMakerStyple.Senior;
- [SerializeField]
- [Header("旋转X或Y")]
- protected List<Transform> rotateXY=new List<Transform>();
- protected Transform topView;
- protected Transform commonBtnView;
- protected Transform seniorView;
- protected Transform extraView;
- protected bool isPlay = false;
- protected GameObject zhenNumberItem;//帧数字
- protected GameObject zhenBgItem;//帧背景
- protected GameObject bodyZhenItem;//身体
- protected GameObject zhenItem;//单位帧
- protected Transform zhenBgList;
- protected Transform bodyZhenList;
- protected Transform zhenList;
- protected float nowTime = 0;//当前帧
- protected float finalTime = 0;//末尾帧
- protected override void OnOpen(object userData)
- {
- base.OnOpen(userData);
- GameObject objItem = FindChildByName(this.gameObject.transform, "Item").gameObject;
- zhenNumberItem = objItem.transform.GetChild(0).gameObject;
- zhenBgItem = objItem.transform.GetChild(1).gameObject;
- bodyZhenItem = objItem.transform.GetChild(2).gameObject;
- zhenItem = objItem.transform.GetChild(3).gameObject;
- rotateXY.Add(FindChildByName(this.gameObject.transform,"RotateY"));
- rotateXY.Add(FindChildByName(this.gameObject.transform, "RotateX"));
- topView = FindChildByName(this.gameObject.transform, "Top");
- ButtonFromTransform(topView.GetChild(0)).onClick.AddListener(SimpleFun);
- ButtonFromTransform(topView.GetChild(1)).onClick.AddListener(SeniorFun);
- ButtonFromTransform(topView.GetChild(2)).onClick.AddListener(SceneDressFun);
- ButtonFromTransform(topView.GetChild(3)).onClick.AddListener(ReturnFun);
- ButtonFromTransform(topView.GetChild(4)).onClick.AddListener(NightLighting);
- ButtonFromTransform(topView.GetChild(4)).onClick.AddListener(SunLighting);
- ButtonFromTransform(topView.GetChild(5)).onClick.AddListener(HalfLighting);
- commonBtnView = FindChildByName(this.gameObject.transform,"CommonButton");
- ButtonFromTransform(commonBtnView.GetChild(0)).onClick.AddListener(SaveBtnFun);
- ButtonFromTransform(commonBtnView.GetChild(1)).onClick.AddListener(MusicBtnFun);
- ButtonFromTransform(commonBtnView.GetChild(2)).onClick.AddListener(FullScreenBtnFun);
- ButtonFromTransform(commonBtnView.GetChild(2)).onClick.AddListener(PlayBtnFun);
- //FindButtonByName(this.gameObject.transform, "BackBtn").onClick.AddListener(SaveBtnFun);
- //FindButtonByName(this.gameObject.transform, "MusicBtn").onClick.AddListener(MusicBtnFun);
- //FindButtonByName(this.gameObject.transform, "FullScreenBtn").onClick.AddListener(FullScreenBtnFun);
- //FindButtonByName(this.gameObject.transform, "PlayBtn").onClick.AddListener(PlayBtnFun);
- seniorView= FindChildByName(this.gameObject.transform, "Senior");
- extraView = FindChildByName(this.gameObject.transform, "Extra");
- }
- protected void SceneDressFun() {
-
- }
- protected void ReturnFun()
- {
-
- }
- protected void SimpleFun() {
- }
- protected void SeniorFun()
- {
-
- }
- /// <summary>
- /// 保存按钮
- /// </summary>
- protected void SaveBtnFun()
- {
-
- }
- /// <summary>
- /// 音乐按钮
- /// </summary>
- protected void MusicBtnFun()
- {
-
- }
- /// <summary>
- /// 全屏按钮
- /// </summary>
- protected void FullScreenBtnFun() {
-
- }
- /// <summary>
- /// 播放按钮
- /// </summary>
- protected void PlayBtnFun() {
- isPlay = !isPlay;
- GameObject saveObj = commonBtnView.GetChild(3).gameObject;
- saveObj.transform.GetChild(1).gameObject.SetActive(isPlay);
- saveObj.transform.GetChild(2).gameObject.SetActive(!isPlay);
- // Transform commonButtonRight = FindChildByName(this.gameObject.transform, "CommonButton");
- }
- /// <summary>
- /// 捏脸按钮
- /// </summary>
- protected void NieLianFun() {
- }
- /// <summary>
- /// 摄像机按钮
- /// </summary>
- protected void CameraBtnFun() {
-
- }
- /// <summary>
- /// 下一帧
- /// </summary>
- protected void NextKBtnFun() {
- if (isPlay)
- {
- return;
- }
- nowTime += 1;
- }
- /// <summary>
- /// 上一帧
- /// </summary>
- protected void LastKBtnFun() {
- if (isPlay)
- {
- return;
- }
- if (nowTime <= 1)
- {
- return;
- }
- nowTime -= 1;
- }
- /// <summary>
- /// 下十帧
- /// </summary>
- protected void NextTenKBtnFun() {
- if (isPlay)
- {
- return;
- }
- nowTime += 10;
- }
- /// <summary>
- /// 上十帧
- /// </summary>
- protected void LastTenKBtnFun() {
- if (isPlay)
- {
- return;
- }
- if (nowTime < 10)
- {
- return;
- }
- nowTime -= 10;
- }
- /// <summary>
- ///旋转X轴
- /// </summary>
- public void RotateXFun() {
-
- }
- /// <summary>
- /// 旋转Y轴
- /// </summary>
- public void RotateYFun() {
- }
- /// <summary>
- /// 移动
- /// </summary>
- public void MoveFun() {
-
- }
- /// <summary>
- ///摄像机
- /// </summary>
- public void CameraFun()
- {
-
- }
- /// <summary>
- /// 捏脸
- /// </summary>
- public void NeiLianFun() {
-
- }
- /// <summary>
- ///夜晚灯光
- /// </summary>
- protected void NightLighting()
- {
- }
- /// <summary>
- ///白天灯光
- /// </summary>
- protected void SunLighting()
- {
- }
- /// <summary>
- ///中午灯光
- /// </summary>
- protected void HalfLighting()
- {
- }
- protected override void OnClose(bool isShutdown, object userData)
- {
- base.OnClose(isShutdown, userData);
- }
- public Button ButtonFromTransform(Transform trans) {
- if (trans.gameObject.GetComponent<Button>() == null)
- {
- trans.gameObject.AddComponent<Button>();
- }
- return trans.gameObject.GetComponent<Button>();
- }
- //public Button FindButtonByName(Transform trans, string name)
- //{
- // Button[] transformArry = trans.GetComponentsInChildren<Button>();
- // foreach (var item in transformArry)
- // {
- // if (item.gameObject.name == name)
- // {
-
- // return item;
- // }
- // }
- // return null;
- //}
- public Transform FindChildByName(Transform trans, string name)
- {
- Transform[] transformArry = trans.GetComponentsInChildren<Transform>();
- foreach (var item in transformArry)
- {
- if (item.gameObject.name == name)
- {
- return item;
- }
- }
- return null;
- }
- protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
- {
- base.OnUpdate(elapseSeconds, realElapseSeconds);
- if (isPlay)
- {
- if (nowTime < finalTime)
- {
- nowTime += 1;
- }
- else
- {
- PlayBtnFun();
- }
- }
- }
- }
- public enum EUIAnimationMakerStyple {
- None,
- Simple,
- Senior,
- }
- }
|