|
@@ -4,6 +4,7 @@ using ET;
|
|
|
using System.Collections.Generic;
|
|
|
using System;
|
|
|
using UnityEngine;
|
|
|
+using System.Collections;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -30,7 +31,7 @@ namespace GFGGame
|
|
|
_curTime = _turnTime;
|
|
|
_luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(luckyBoxId);
|
|
|
_com.GetChild("loaMask").asLoader.url = ResPathUtil.GetBgImgPath(_luckyBoxCfg.bgResArr[_bgIndex]);
|
|
|
- ChangeRes();
|
|
|
+ UpdateRes();
|
|
|
Timers.inst.Remove(UpdateTime);
|
|
|
if (_luckyBoxCfg.resArr.Length > 1 || _luckyBoxCfg.suitIdArr.Length > 1)
|
|
|
{
|
|
@@ -51,18 +52,24 @@ namespace GFGGame
|
|
|
_modelIndex = _modelIndex + 1 == _luckyBoxCfg.suitIdArr.Length ? 0 : _modelIndex + 1;
|
|
|
}
|
|
|
|
|
|
- _com.GetTransition("t0").Play(ChangeRes);
|
|
|
+ _com.GetTransition("t0").Play(UpdateRes);
|
|
|
// ChangeRes();
|
|
|
}
|
|
|
-
|
|
|
- private void ChangeRes()
|
|
|
+ private void UpdateRes()
|
|
|
+ {
|
|
|
+ Timers.inst.StartCoroutine(ChangeRes());
|
|
|
+ }
|
|
|
+ private IEnumerator ChangeRes()
|
|
|
{
|
|
|
UI_ComModel _comModel = UI_ComModel.Proxy(_com);
|
|
|
_comModel.m_loaBg.url = ResPathUtil.GetBgImgPath(_luckyBoxCfg.bgResArr[_bgIndex]);
|
|
|
if (_luckyBoxCfg.resArr.Length > 0)
|
|
|
{
|
|
|
+ int direction = _luckyBoxCfg.scaleArr[_modelIndex] >= 0 ? 1 : -1;
|
|
|
+ float scale = _luckyBoxCfg.scaleArr.Length > 0 ? Math.Abs(_luckyBoxCfg.scaleArr[_modelIndex]) / 10000f : 1;
|
|
|
_comModel.m_loaRes.url = string.Format("ui://LuckyBox/{0}", _luckyBoxCfg.resArr[_modelIndex]);
|
|
|
_comModel.m_loaRes.SetPosition(_luckyBoxCfg.posArr[_modelIndex][0], _luckyBoxCfg.posArr[_modelIndex][1], 1);
|
|
|
+ _comModel.m_loaRes.SetScale(direction * scale, scale);
|
|
|
}
|
|
|
else if (_luckyBoxCfg.suitIdArr.Length > 0)
|
|
|
{
|
|
@@ -83,19 +90,21 @@ namespace GFGGame
|
|
|
else
|
|
|
{
|
|
|
_comModel.m_loaRes.url = "";
|
|
|
-
|
|
|
+ _comModel.m_loaMask.alpha = 1;
|
|
|
+ yield return null;
|
|
|
int scale = _luckyBoxCfg.scaleArr.Length > 0 ? Math.Abs(_luckyBoxCfg.scaleArr[_modelIndex]) / 10000 : 100;
|
|
|
_dressUpObjUI.ResetSceneObj(scale, false, false, null, false);
|
|
|
_dressUpObjUI.dressUpObj.PutOnSuitCfg(_luckyBoxCfg.suitIdArr[_modelIndex], true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
|
|
|
_dressUpObjUI.UpdateWrapper(_comModel.m_holder);
|
|
|
_dressUpObjUI.sceneObject.transform.localScale = new Vector3(direction * scale, scale, scale);
|
|
|
_comModel.m_holder.SetPosition(_luckyBoxCfg.posArr[_modelIndex][0], _luckyBoxCfg.posArr[_modelIndex][1], 1);
|
|
|
+ yield return null;
|
|
|
}
|
|
|
}
|
|
|
_comModel.m_t1.Play();
|
|
|
- // _com.GetTransition("t1").Play();
|
|
|
UI_ComModel.ProxyEnd();
|
|
|
}
|
|
|
+
|
|
|
public void OnHide()
|
|
|
{
|
|
|
_bgIndex = 0;
|