|
@@ -0,0 +1,287 @@
|
|
|
+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 float nowTime = 0;//当前帧
|
|
|
+ protected float finalTime = 0;//末尾帧
|
|
|
+ protected override void OnOpen(object userData)
|
|
|
+ {
|
|
|
+
|
|
|
+ base.OnOpen(userData);
|
|
|
+ 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,
|
|
|
+ }
|
|
|
+}
|