Ejemplo n.º 1
0
 public ExchangeElement(ExchangePhase phase, GameObject uiItem, ExchangeWgt owner, int index)
 {
     this.phase  = phase;
     this.uiItem = uiItem;
     this.owner  = owner;
     this.index  = index;
     this.Validate();
 }
Ejemplo n.º 2
0
 public ExchangeActivity(ActivitySys mgr, ResCltWealExchange config) : base(mgr, config.stCommon)
 {
     this._config = config;
     for (uint num = 0u; num < (uint)config.bExchangeCnt; num += 1u)
     {
         ExchangePhase ap = new ExchangePhase(this, config.astExchangeList[(int)((uint)((UIntPtr)num))]);
         base.AddPhase(ap);
     }
 }
Ejemplo n.º 3
0
 public ExchangeActivity(ActivitySys mgr, ResCltWealExchange config) : base(mgr, config.stCommon)
 {
     this._exchangeCount = new Dictionary <int, uint>();
     this._config        = config;
     for (uint i = 0; i < config.bExchangeCnt; i++)
     {
         ExchangePhase ap = new ExchangePhase(this, i, config.astExchangeList[i]);
         base.AddPhase(ap);
     }
 }
Ejemplo n.º 4
0
        private void UpdateOneElement(int index)
        {
            ListView <ActivityPhase> phaseList = base.view.activity.PhaseList;

            if ((index < phaseList.Count) && (this._elementsGo != null))
            {
                ExchangePhase phase = phaseList[index] as ExchangePhase;
                GameObject    obj2  = null;
                bool          flag  = this._elementsGo.TryGetValue(index, out obj2);
                if ((phase != null) && (obj2 != null))
                {
                    obj2.CustomSetActive(true);
                    ResDT_Item_Info info          = null;
                    ResDT_Item_Info info2         = null;
                    ResDT_Item_Info stResItemInfo = null;
                    stResItemInfo = phase.Config.stResItemInfo;
                    if (phase.Config.bColItemCnt > 0)
                    {
                        info = phase.Config.astColItemInfo[0];
                    }
                    if (phase.Config.bColItemCnt > 1)
                    {
                        info2 = phase.Config.astColItemInfo[1];
                    }
                    CUseableContainer useableContainer = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo().GetUseableContainer(enCONTAINER_TYPE.ITEM);

                    if (useableContainer != null)
                    {
                        int num  = (info != null) ? useableContainer.GetUseableStackCount((COM_ITEM_TYPE)info.wItemType, info.dwItemID) : 0;
                        int num2 = (info2 != null) ? useableContainer.GetUseableStackCount((COM_ITEM_TYPE)info2.wItemType, info2.dwItemID) : 0;
                        if (stResItemInfo != null)
                        {
                            GameObject gameObject = obj2.transform.FindChild("DuihuanBtn").gameObject;
                            gameObject.GetComponent <CUIEventScript>().m_onClickEventParams.commonUInt64Param1 = phase.Config.bIdx;
                            if (base.view.activity.timeState == Activity.TimeState.Close)
                            {
                                CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), false, false, true);
                            }
                            if (info != null)
                            {
                                CUseable   useable2 = CUseableManager.CreateUseable((COM_ITEM_TYPE)info.wItemType, info.dwItemID, 1);
                                GameObject obj4     = obj2.transform.FindChild("Panel/ItemCell1").gameObject;
                                CUICommonSystem.SetItemCell(base.view.form.formScript, obj4, useable2, true, false);
                                int    useableStackCount = useableContainer.GetUseableStackCount((COM_ITEM_TYPE)info.wItemType, info.dwItemID);
                                ushort wItemCnt          = info.wItemCnt;
                                Text   component         = obj2.transform.FindChild("Panel/ItemCell1/ItemCount").gameObject.GetComponent <Text>();
                                if (useableStackCount < wItemCnt)
                                {
                                    component.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), useableStackCount, wItemCnt);
                                    CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), false, false, true);
                                }
                                else
                                {
                                    component.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), useableStackCount, wItemCnt);
                                }
                            }
                            if (info2 != null)
                            {
                                CUseable   useable3 = CUseableManager.CreateUseable((COM_ITEM_TYPE)info2.wItemType, info2.dwItemID, 1);
                                GameObject obj5     = obj2.transform.FindChild("Panel/ItemCell2").gameObject;
                                obj5.CustomSetActive(true);
                                CUICommonSystem.SetItemCell(base.view.form.formScript, obj5, useable3, true, false);
                                int    num5  = useableContainer.GetUseableStackCount((COM_ITEM_TYPE)info2.wItemType, info2.dwItemID);
                                ushort num6  = info2.wItemCnt;
                                Text   text2 = obj2.transform.FindChild("Panel/ItemCell2/ItemCount").gameObject.GetComponent <Text>();
                                if (num5 < num6)
                                {
                                    text2.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemNotEnoughCount"), num5, num6);
                                    CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), false, false, true);
                                }
                                else
                                {
                                    text2.text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_ItemCount"), num5, num6);
                                }
                            }
                            else
                            {
                                obj2.transform.FindChild("Panel/ItemCell2").gameObject.CustomSetActive(false);
                                obj2.transform.FindChild("Panel/Add").gameObject.CustomSetActive(false);
                            }
                            CUseable   itemUseable = CUseableManager.CreateUseable((COM_ITEM_TYPE)stResItemInfo.wItemType, stResItemInfo.dwItemID, 1);
                            GameObject itemCell    = obj2.transform.FindChild("Panel/GetItemCell").gameObject;
                            CUICommonSystem.SetItemCell(base.view.form.formScript, itemCell, itemUseable, true, false);
                            ExchangeActivity activity = base.view.activity as ExchangeActivity;
                            if (activity != null)
                            {
                                GameObject obj9             = obj2.transform.FindChild("ExchangeCount").gameObject;
                                uint       maxExchangeCount = activity.GetMaxExchangeCount(phase.Config.bIdx);
                                uint       exchangeCount    = activity.GetExchangeCount(phase.Config.bIdx);
                                if (maxExchangeCount > 0)
                                {
                                    obj9.CustomSetActive(true);
                                    obj9.GetComponent <Text>().text = string.Format(Singleton <CTextManager> .GetInstance().GetText("Exchange_TimeLimit"), exchangeCount, maxExchangeCount);
                                    if (exchangeCount >= maxExchangeCount)
                                    {
                                        CUICommonSystem.SetButtonEnable(gameObject.GetComponent <Button>(), false, false, true);
                                    }
                                }
                                else
                                {
                                    obj9.CustomSetActive(false);
                                }
                            }
                        }
                    }
                }
            }
        }