您当前的位置: 首页 >  unity

Peter_Gao_

暂无认证

  • 1浏览

    0关注

    621博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

unity插件DOTween制作假的进度条

Peter_Gao_ 发布时间:2020-06-18 18:06:38 ,浏览量:1

    /// 基础UI窗体     public class BaseUIForm : MonoBehaviour     {         protected string MsgTypeName = "";  // 该类的消息名

        private void Awake()         {             //初始化基础信息             Initialization();             //初始化UI信息             InitUIInfo();            //初始化UI按钮点击事件            InitButtonClickEvent();

            if (MsgTypeName != "")             {                 ReceiveMessage(MsgTypeName, ReceiveMsg);             }

            LanguageManager.Instance.AddRefreshUI(RefreshUIText);         }

}

-------------------------------------------------------------------------------------------------------------

// 窗体子类

public class MissionInfoUI : BaseUIForm

{

 protected override void InitButtonClickEvent()     {         //注册开始任务按钮         RegisterButtonObjectEvent("StartMissionButton", p=>          {              CloseUIForm();         });         //注册改变任务按钮         RegisterButtonObjectEvent("ChangeMissionButton", p =>         {             //判断是否有足够的钱刷新任务             if (MainManager.CostCoins(100))             {                 StartCoroutine(GetMissionIE(true));             }         });     }

    protected override void ReceiveMsg(KeyValuesUpdate KV)     {         switch (KV.Key)         {             //刷新任务             case SysDefine.SYS_MSG_KIND_RefreshMission:                 {                     StartCoroutine( GetMissionIE() );                 }                 break;         }     }

 

  IEnumerator GetMissionIE(bool IsChangeMission = false)     {         GetMission(IsChangeMission);

        //隐藏背景和任务UI         GetComponent().color = new Color(GetComponent().color.r,              GetComponent().color.g, GetComponent().color.b, 0);

        trans_MissionBox.Hide();         //transform.FindChild("TTTT").SetSprite();         FindChild(this.gameObject, "MissionTitle").Hide();         ChangeMissionButton.Hide();

        // 显示接取任务的滑条动画(只显示根节点即可)         trans_MissionSlider.Show();         Image FillArea = FindChild(trans_MissionSlider.gameObject, "FillArea");

        // 滑条从0开始填充到1结束,用时1.5秒         FillArea.fillAmount = 0f;

        // 插件DOTween方法 DOFillAmount( this Image target, float endValue, float duration )         FillArea.DOFillAmount(1f, 1.5f);         yield return new WaitForSeconds(1.5f);

        //隐藏任务滑条         trans_MissionSlider.Hide();

        //显示任务信息         GetComponent().color = new Color(GetComponent().color.r, GetComponent().color.g, GetComponent().color.b, 1);

        trans_MissionBox.Show();         FindChild(this.gameObject, "MissionTitle").Show();         ChangeMissionButton.Show();     }

 

}

关注
打赏
1664521772
查看更多评论
立即登录/注册

微信扫码登录

0.2749s