예제 #1
0
        public CSymbolBuyPickDialog(ResSymbolInfo symbolInfo, RES_SHOPBUY_COINTYPE coinType, float discount, CSymbolBuyPickDialog.OnConfirmBuyDelegate onConfirm, CSymbolBuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
        {
            CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo();

            if (masterRoleInfo == null)
            {
                return;
            }
            CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM);

            this._usb = (useableContainer.GetUseableByBaseID(5, symbolInfo.dwID) as CSymbolItem);
            if (this._usb == null)
            {
                this._usb = (CUseableManager.CreateUseable(5, symbolInfo.dwID, 0) as CSymbolItem);
            }
            if (this._usb == null)
            {
                return;
            }
            CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(CSymbolBuyPickDialog.s_Form_Path, false, true);

            if (null != cUIFormScript)
            {
                this._root        = cUIFormScript.gameObject;
                this._itemCell    = Utility.FindChild(this._root, "Panel/itemCell");
                this._callContext = symbolInfo;
                this._count       = 1u;
                if ((long)this._usb.m_stackCount >= 10L)
                {
                    this._maxCount = 1u;
                }
                else
                {
                    this._maxCount = (uint)(10 - this._usb.m_stackCount);
                }
                this._onConfirm        = onConfirm;
                this._onConfirmdCommon = onConfirmCommon;
                this._uieventPars      = uieventPars;
                this._coinType         = coinType;
                this._realDiscount     = discount;
                if (this._usb != null)
                {
                    this._countText = Utility.GetComponetInChild <Text>(this._root, "Panel/Count");
                    this._costText  = Utility.GetComponetInChild <Text>(this._root, "Panel/Cost");
                    CUICommonSystem.SetItemCell(cUIFormScript, this._itemCell, this._usb, true, false, false, false);
                    this._descText = Utility.GetComponetInChild <Text>(this._root, "Panel/itemCell/SymbolDesc");
                    if (this._descText != null)
                    {
                        this._descText.text = CSymbolSystem.GetSymbolAttString(symbolInfo.dwID, true);
                    }
                    this._coinUsb = CUseableManager.CreateCoinUseable(coinType, 0);
                    if (this._coinUsb != null)
                    {
                        Utility.GetComponetInChild <Image>(this._root, "Panel/Cost/CoinType").SetSprite(CUIUtility.GetSpritePrefeb(this._coinUsb.GetIconPath(), false, false), false);
                        Utility.GetComponetInChild <Text>(this._root, "Panel/Price").text = this._usb.GetBuyPrice(this._coinType).ToString();
                    }
                }
                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_CloseForm, new CUIEventManager.OnUIEventHandler(this.OnCloseForm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Add, new CUIEventManager.OnUIEventHandler(this.OnClickAdd));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Dec, new CUIEventManager.OnUIEventHandler(this.OnClickDec));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Max, new CUIEventManager.OnUIEventHandler(this.OnClickMax));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Confirm, new CUIEventManager.OnUIEventHandler(this.OnClickConfirm));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_Cancel, new CUIEventManager.OnUIEventHandler(this.OnClickCancel));

                Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.BuyPick_ConfirmFactoryShopBuy, new CUIEventManager.OnUIEventHandler(this.OnConfirmFactoryShopBuy));

                this.ValidateDynamic();
            }
        }
예제 #2
0
 public static void Show(ResSymbolInfo symbolInfo, RES_SHOPBUY_COINTYPE coinType, float discount, CSymbolBuyPickDialog.OnConfirmBuyDelegate onClose, CSymbolBuyPickDialog.OnConfirmBuyCommonDelegate onConfirmCommon = null, CUIEvent uieventPars = null)
 {
     if (CSymbolBuyPickDialog.s_theDlg == null)
     {
         CSymbolBuyPickDialog.s_theDlg = new CSymbolBuyPickDialog(symbolInfo, coinType, discount, onClose, onConfirmCommon, uieventPars);
         if (CSymbolBuyPickDialog.s_theDlg._root == null)
         {
             CSymbolBuyPickDialog.s_theDlg = null;
         }
     }
 }