|
@@ -9,12 +9,13 @@ namespace GFGGame
|
|
{
|
|
{
|
|
private UI_LuckBoxBonusUI _ui;
|
|
private UI_LuckBoxBonusUI _ui;
|
|
private List<ItemData> itemList;
|
|
private List<ItemData> itemList;
|
|
|
|
+ private List<ItemData> itemListAni;
|
|
private GComponent _curComItem;
|
|
private GComponent _curComItem;
|
|
private int openCount = 0;
|
|
private int openCount = 0;
|
|
private List<ItemData> newItemList = new List<ItemData>();
|
|
private List<ItemData> newItemList = new List<ItemData>();
|
|
private List<int> newCardList = new List<int>();
|
|
private List<int> newCardList = new List<int>();
|
|
- private int openIndex = 0;
|
|
|
|
- // private List<int> openIndexList = new List<int>();
|
|
|
|
|
|
+ private List<bool> openState = new List<bool>();
|
|
|
|
+ // private int openIndex = 0;
|
|
|
|
|
|
private List<GameObject> _gameobjects = new List<GameObject>();
|
|
private List<GameObject> _gameobjects = new List<GameObject>();
|
|
private List<GoWrapper> _wrappers = new List<GoWrapper>();
|
|
private List<GoWrapper> _wrappers = new List<GoWrapper>();
|
|
@@ -50,14 +51,7 @@ namespace GFGGame
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bj_ckzxin");
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bj_ckzxin");
|
|
_ui.m_loaOpen.onClick.Add(OnClickOpen);
|
|
_ui.m_loaOpen.onClick.Add(OnClickOpen);
|
|
_ui.m_btnPass.onClick.Add(OnBtnPassClick);
|
|
_ui.m_btnPass.onClick.Add(OnBtnPassClick);
|
|
- string resPath = ResPathUtil.GetViewEffectPath("ui_ck", "ui_ck_fk");
|
|
|
|
- SceneController.AddObjectToView(null, null, _ui.m_itemOne.m_holder, resPath, out _gameobject, out _wrapper);
|
|
|
|
- for (int i = 0; i < 10; i++)
|
|
|
|
- {
|
|
|
|
- SceneController.AddObjectToView(null, null, _ui.m_itemOne.m_holder, resPath, out GameObject gameobject, out GoWrapper wrapper);
|
|
|
|
- _gameobjects.Add(gameobject);
|
|
|
|
- _wrappers.Add(wrapper);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
@@ -65,6 +59,7 @@ namespace GFGGame
|
|
base.OnShown();
|
|
base.OnShown();
|
|
|
|
|
|
itemList = (viewData as object[])[0] as List<ItemData>;
|
|
itemList = (viewData as object[])[0] as List<ItemData>;
|
|
|
|
+ itemListAni = new List<ItemData>(itemList.ToArray());
|
|
_ui.m_loaOpen.visible = true;
|
|
_ui.m_loaOpen.visible = true;
|
|
_ui.m_loaMask.visible = true;
|
|
_ui.m_loaMask.visible = true;
|
|
if (itemList != null)
|
|
if (itemList != null)
|
|
@@ -94,12 +89,41 @@ namespace GFGGame
|
|
// _ui.m_itemOne.target.visible = false;
|
|
// _ui.m_itemOne.target.visible = false;
|
|
_ui.m_t1.Play();
|
|
_ui.m_t1.Play();
|
|
openCount = 0;
|
|
openCount = 0;
|
|
- openIndex = 0;
|
|
|
|
|
|
+ // openIndex = 0;
|
|
newCardList.Clear();
|
|
newCardList.Clear();
|
|
newItemList.Clear();
|
|
newItemList.Clear();
|
|
|
|
+ itemList.Clear();
|
|
Timers.inst.Remove(UpdateTime);
|
|
Timers.inst.Remove(UpdateTime);
|
|
|
|
+ for (int i = 0; i < openState.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ openState[i] = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ private void InitAllItem()
|
|
|
|
+ {
|
|
|
|
+ string resPath = ResPathUtil.GetViewEffectPath("ui_ck", "ui_ck_fk");
|
|
|
|
+ UI_LuckyBoxBonusItem itemUI = UI_LuckyBoxBonusItem.Proxy(_ui.m_itemOne.target);
|
|
|
|
+ itemUI.target.onClick.Add(OnClickItem);
|
|
|
|
+ itemUI.m_comIcon.m_icon.onClick.Add(OnClickItemTips);
|
|
|
|
+ SceneController.AddObjectToView(null, null, itemUI.m_holder, resPath, out _gameobject, out _wrapper);
|
|
|
|
+ UI_LuckyBoxBonusItem.ProxyEnd();
|
|
|
|
|
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
|
+ {
|
|
|
|
+ GObject itemObject = _ui.target.GetChild("item" + i);
|
|
|
|
+ if (itemObject != null)
|
|
|
|
+ {
|
|
|
|
+ UI_LuckyBoxBonusItem itemUITen = UI_LuckyBoxBonusItem.Proxy(itemObject);
|
|
|
|
+ itemUITen.target.onClick.Add(OnClickItem);
|
|
|
|
+ itemUITen.m_comIcon.m_icon.onClick.Add(OnClickItemTips);
|
|
|
|
+ SceneController.AddObjectToView(null, null, itemUITen.m_holder, resPath, out GameObject gameobject, out GoWrapper wrapper);
|
|
|
|
+ _gameobjects.Add(gameobject);
|
|
|
|
+ _wrappers.Add(wrapper);
|
|
|
|
+ UI_LuckyBoxBonusItem.ProxyEnd();
|
|
|
|
+ openState.Add(false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
private void OnClickBg()
|
|
private void OnClickBg()
|
|
{
|
|
{
|
|
this.Hide();
|
|
this.Hide();
|
|
@@ -124,12 +148,14 @@ namespace GFGGame
|
|
GObject itemObject = _ui.target.GetChild("item" + i);
|
|
GObject itemObject = _ui.target.GetChild("item" + i);
|
|
if (itemObject != null)
|
|
if (itemObject != null)
|
|
{
|
|
{
|
|
|
|
+ _gameobjects[i].SetActive(false);
|
|
UpdateItem(i, itemObject);
|
|
UpdateItem(i, itemObject);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ _gameobject.SetActive(false);
|
|
UpdateItem(0, _ui.m_itemOne.target);
|
|
UpdateItem(0, _ui.m_itemOne.target);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -152,45 +178,20 @@ namespace GFGGame
|
|
count++;
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
itemUI.m_comIcon.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
itemUI.m_comIcon.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
itemUI.m_comIcon.m_imgNew.visible = ItemDataManager.GetItemNum(itemData.id) == count && isFirst ? true : false;
|
|
itemUI.m_comIcon.m_imgNew.visible = ItemDataManager.GetItemNum(itemData.id) == count && isFirst ? true : false;
|
|
string itemName = itemCfg.name;
|
|
string itemName = itemCfg.name;
|
|
- // if (itemData.num > 1)
|
|
|
|
- // {
|
|
|
|
- // itemName += "x" + itemData.num;
|
|
|
|
- // }
|
|
|
|
itemUI.m_comIcon.m_txtName.text = itemName;
|
|
itemUI.m_comIcon.m_txtName.text = itemName;
|
|
itemUI.m_c1.selectedIndex = itemCfg.rarity;
|
|
itemUI.m_c1.selectedIndex = itemCfg.rarity;
|
|
itemUI.m_comIcon.m_c1.selectedIndex = itemCfg.rarity;
|
|
itemUI.m_comIcon.m_c1.selectedIndex = itemCfg.rarity;
|
|
RarityIconController.UpdateRarityIcon(itemUI.m_comIcon.m_rarity, itemData.id, false);
|
|
RarityIconController.UpdateRarityIcon(itemUI.m_comIcon.m_rarity, itemData.id, false);
|
|
itemUI.m_comIcon.m_icon.data = itemData.id;
|
|
itemUI.m_comIcon.m_icon.data = itemData.id;
|
|
- itemUI.target.data = itemData;
|
|
|
|
- // itemUI.m_comIcon.target.SetScale(0, 0);
|
|
|
|
- // itemUI.m_t0.Play();
|
|
|
|
- itemUI.m_c2.selectedIndex = 0;
|
|
|
|
|
|
+ itemUI.target.data = index;
|
|
|
|
+ itemUI.m_t0.Play();
|
|
UI_LuckyBoxBonusItem.ProxyEnd();
|
|
UI_LuckyBoxBonusItem.ProxyEnd();
|
|
}
|
|
}
|
|
|
|
|
|
- private void InitAllItem()
|
|
|
|
- {
|
|
|
|
- UI_LuckyBoxBonusItem itemUI = UI_LuckyBoxBonusItem.Proxy(_ui.m_itemOne.target);
|
|
|
|
- itemUI.target.onClick.Add(OnClickItem);
|
|
|
|
- itemUI.m_comIcon.m_icon.onClick.Add(OnClickItemTips);
|
|
|
|
- UI_LuckyBoxBonusItem.ProxyEnd();
|
|
|
|
- for (int i = 0; i < 10; i++)
|
|
|
|
- {
|
|
|
|
- GObject itemObject = _ui.target.GetChild("item" + i);
|
|
|
|
- if (itemObject != null)
|
|
|
|
- {
|
|
|
|
- UI_LuckyBoxBonusItem itemUITen = UI_LuckyBoxBonusItem.Proxy(itemObject);
|
|
|
|
- itemUITen.target.onClick.Add(OnClickItem);
|
|
|
|
- itemUITen.m_comIcon.m_icon.onClick.Add(OnClickItemTips);
|
|
|
|
- UI_LuckyBoxBonusItem.ProxyEnd();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
private void OnClickItem(EventContext context)
|
|
private void OnClickItem(EventContext context)
|
|
{
|
|
{
|
|
GComponent item = context.sender as GComponent;
|
|
GComponent item = context.sender as GComponent;
|
|
@@ -229,15 +230,25 @@ namespace GFGGame
|
|
|
|
|
|
}
|
|
}
|
|
_curComItem = component;
|
|
_curComItem = component;
|
|
|
|
+ int index = (int)_curComItem.data;
|
|
|
|
+ if (itemList.Count == 1)
|
|
|
|
+ {
|
|
|
|
+ _gameobject.SetActive(true);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _gameobjects[index].SetActive(true);
|
|
|
|
+ }
|
|
transition.Play(UpdateOpenCount);
|
|
transition.Play(UpdateOpenCount);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
private void UpdateOpenCount()
|
|
private void UpdateOpenCount()
|
|
{
|
|
{
|
|
GImage imgNew = _curComItem.GetChild("comIcon").asCom.GetChild("imgNew").asImage;
|
|
GImage imgNew = _curComItem.GetChild("comIcon").asCom.GetChild("imgNew").asImage;
|
|
|
|
+ int index = (int)_curComItem.data;
|
|
if (imgNew.visible)
|
|
if (imgNew.visible)
|
|
{
|
|
{
|
|
- ItemData itemData = _curComItem.data as ItemData;
|
|
|
|
|
|
+ ItemData itemData = itemList[index];
|
|
ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemData.id);
|
|
ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemData.id);
|
|
if (cfg.itemType == ConstItemType.DRESS_UP)
|
|
if (cfg.itemType == ConstItemType.DRESS_UP)
|
|
{
|
|
{
|
|
@@ -252,6 +263,7 @@ namespace GFGGame
|
|
}
|
|
}
|
|
}
|
|
}
|
|
openCount++;
|
|
openCount++;
|
|
|
|
+ openState[index] = true;
|
|
_ui.m_loaMask.visible = false;
|
|
_ui.m_loaMask.visible = false;
|
|
|
|
|
|
if (openCount == itemList.Count)
|
|
if (openCount == itemList.Count)
|
|
@@ -281,44 +293,50 @@ namespace GFGGame
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- Timers.inst.Add(0.3f, itemList.Count, UpdateTime);
|
|
|
|
|
|
+ Timers.inst.Add(0.3f, openState.Count - openCount, UpdateTime);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
private void UpdateTime(object param)
|
|
private void UpdateTime(object param)
|
|
{
|
|
{
|
|
- ET.Log.Debug("zoya: openIndex:" + openIndex);
|
|
|
|
- GComponent component = _ui.target.GetChild("item" + openIndex).asCom;
|
|
|
|
- ET.Log.Debug("zoya: component:" + component);
|
|
|
|
|
|
+ int index = 0;
|
|
|
|
+ GComponent component = null;
|
|
|
|
+ for (int i = 0; i < openState.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ if (openState[i] == false)
|
|
|
|
+ {
|
|
|
|
+ index = i;
|
|
|
|
+ component = _ui.target.GetChild("item" + i).asCom;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
Transition transition = component.GetTransition("t1");
|
|
Transition transition = component.GetTransition("t1");
|
|
- ET.Log.Debug("zoya: transition:" + transition);
|
|
|
|
GComponent comIcon = component.GetChild("comIcon").asCom;
|
|
GComponent comIcon = component.GetChild("comIcon").asCom;
|
|
- ET.Log.Debug("zoya: comIcon:" + comIcon);
|
|
|
|
GImage imgNew = comIcon.GetChild("imgNew").asImage;
|
|
GImage imgNew = comIcon.GetChild("imgNew").asImage;
|
|
- ET.Log.Debug("zoya: imgNew:" + imgNew);
|
|
|
|
- openIndex++;
|
|
|
|
if (transition.playing || comIcon.skew == Vector2.zero) return;
|
|
if (transition.playing || comIcon.skew == Vector2.zero) return;
|
|
openCount++;
|
|
openCount++;
|
|
|
|
+ openState[index] = true;
|
|
if (imgNew.visible)
|
|
if (imgNew.visible)
|
|
{
|
|
{
|
|
- ItemData itemData = component.data as ItemData;
|
|
|
|
|
|
+ ItemData itemData = itemList[index];
|
|
ET.Log.Debug("zoya: itemData:" + itemData);
|
|
ET.Log.Debug("zoya: itemData:" + itemData);
|
|
ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemData.id);
|
|
ItemCfg cfg = ItemCfgArray.Instance.GetCfg(itemData.id);
|
|
if (cfg.itemType == ConstItemType.DRESS_UP)
|
|
if (cfg.itemType == ConstItemType.DRESS_UP)
|
|
{
|
|
{
|
|
- newItemList.Add(itemData);
|
|
|
|
|
|
+ newItemList.Insert(0, itemData);
|
|
}
|
|
}
|
|
else if (cfg.itemType == ConstItemType.CARD)
|
|
else if (cfg.itemType == ConstItemType.CARD)
|
|
{
|
|
{
|
|
- newCardList.Add(itemData.id);
|
|
|
|
|
|
+ newCardList.Insert(0, itemData.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (openCount == itemList.Count)
|
|
if (openCount == itemList.Count)
|
|
{
|
|
{
|
|
|
|
+ _gameobject.SetActive(true);
|
|
transition.Play(PlayComplete);
|
|
transition.Play(PlayComplete);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ _gameobjects[index].SetActive(true);
|
|
transition.Play();
|
|
transition.Play();
|
|
}
|
|
}
|
|
|
|
|