Пример #1
0
        /// <summary>
        /// Override to allow the click and longclick events to be grabbed.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="convertView"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        public override View GetDropDownView(int position, View convertView, ViewGroup parent)
        {
            View view = convertView;

            if (view == null)
            {
                // If this is a new view then let the base class create it and then link into its click events
                view     = base.GetDropDownView(position, convertView, parent);
                view.Tag = position;

                // A longclick is assumed to be a request to delete the item.
                // Hide the spinner and send the event to its handler
                view.LongClick += (sender, e) => {
                    ownerSpinner.OnDetachedFromWindowPublic();

                    LongClickEvent?.Invoke(this, new LongClickEventArgs {
                        TripPosition = ( int )view.Tag
                    });
                };

                // When an item is clicked hide the dropdown items and select the item (via its view tag)
                view.Click += (sender, e) => {
                    ownerSpinner.OnDetachedFromWindowPublic();
                    ownerSpinner.SetSelection(( int )(( View )sender).Tag);
                };
            }
            else
            {
                view = base.GetDropDownView(position, convertView, parent);
                // make sure that this view is associated with the item
                view.Tag = position;
            }

            return(view);
        }
Пример #2
0
 void OnPress(GameObject go, bool isPress)
 {
     if (addBtn != null && go == addBtn.gameObject)
     {
         LongClickEvent.Get(addBtn.gameObject).time = 0;
         int amount = int.Parse(changeNum.text);
         if (int.Parse(changeNum.text) == info.amount)
         {
             return;
         }
         amount++;
         changeNum.text = amount.ToString();
         sellPrcie.text = (amount * item.itemPrice).ToString();
     }
     else if (subtractBtn != null && go == subtractBtn.gameObject)
     {
         LongClickEvent.Get(subtractBtn.gameObject).time = 0;
         int amount = int.Parse(changeNum.text);
         if (int.Parse(changeNum.text) == 1)
         {
             return;
         }
         amount--;
         changeNum.text = amount.ToString();
         sellPrcie.text = (amount * item.itemPrice).ToString();
     }
 }
Пример #3
0
 void OnPress(GameObject go, bool pressed)
 {
     if (go == panel.add_btn.gameObject)
     {
         LongClickEvent.Get(panel.add_btn.gameObject).time = 0;
         if (moneycount == 999)
         {
             return;
         }
         moneycount++;
         panel.count_label.text = moneycount.ToString();
         panel.money_label.text = moneycount * mGuildBase.euroPer + "";
     }
     else if (go == panel.sub_btn.gameObject)
     {
         LongClickEvent.Get(panel.sub_btn.gameObject).time = 0;
         if (moneycount <= 1)
         {
             return;
         }
         moneycount--;
         panel.count_label.text = moneycount.ToString();
         panel.money_label.text = moneycount * mGuildBase.euroPer + "";
     }
 }
Пример #4
0
 protected override void AddComponentEvents()
 {
     UIEventListener.Get(panel.off_btn.gameObject).onClick      = OnClick;
     UIEventListener.Get(panel.donation_btn.gameObject).onClick = OnClick;
     LongClickEvent.Get(panel.sub_btn.gameObject).onPress       = OnPress;
     LongClickEvent.Get(panel.add_btn.gameObject).onPress       = OnPress;
     LongClickEvent.Get(panel.sub_btn.gameObject).duration      = 4f;
     LongClickEvent.Get(panel.add_btn.gameObject).duration      = 4f;
 }
Пример #5
0
    public static LongClickEvent Get(GameObject go)
    {
        if (!go.GetComponent <LongClickEvent>())
        {
            go.AddComponent <LongClickEvent>();
        }
        LongClickEvent listener = go.GetComponent <LongClickEvent>();

        return(listener);
    }
Пример #6
0
    protected override void Register()
    {
        UIEventListener.Get(btn).onClick     = OnClick;
        UIEventListener.Get(backBtn).onClick = OnClick;
        UIEventListener.Get(sure).onClick    = OnClick;

        LongClickEvent.Get(leftBtn).onPress  = OnClickPress;
        LongClickEvent.Get(rightBtn).onPress = OnClickPress;
        LongClickEvent.Get(upBtn).onPress    = OnClickPress;
        LongClickEvent.Get(downBtn).onPress  = OnClickPress;
    }
Пример #7
0
 protected override void AddComponentEvents()
 {
     UIEventListener.Get(panel.cancelBtn.gameObject).onClick   = OnClick;
     UIEventListener.Get(panel.buyBtn.gameObject).onClick      = OnClick;
     UIEventListener.Get(panel.minBtn.gameObject).onClick      = OnClick;
     UIEventListener.Get(panel.maxBtn.gameObject).onClick      = OnClick;
     LongClickEvent.Get(panel.subtractBtn.gameObject).onPress  = OnPress;
     LongClickEvent.Get(panel.addBtn.gameObject).onPress       = OnPress;
     LongClickEvent.Get(panel.subtractBtn.gameObject).duration = 3;
     LongClickEvent.Get(panel.addBtn.gameObject).duration      = 3;
 }
Пример #8
0
 void OnPress(GameObject go, bool pressed)
 {
     if (go == panel.addBtn.gameObject)
     {
         LongClickEvent.Get(panel.addBtn.gameObject).time = 0;
         if (panel.changeNum.text == "999")
         {
             return;
         }
         panel.changeNum.text = (UtilTools.IntParse(panel.changeNum.text) + 1).ToString();
     }
     else
     {
         LongClickEvent.Get(panel.subtractBtn.gameObject).time = 0;
         if (panel.changeNum.text == "1")
         {
             return;
         }
         panel.changeNum.text = (UtilTools.IntParse(panel.changeNum.text) - 1).ToString();
     }
     panel.needDiamond.text = string.Format(TextManager.GetUIString("UIBasize1"), UtilTools.IntParse(panel.changeNum.text) * bagSizeInfo.needDimaond);
 }
Пример #9
0
 protected override void AddComponentEvents()
 {
     UIEventListener.Get(panel.backBtn.gameObject).onClick       = OnClick;
     UIEventListener.Get(panel.equipBtn.gameObject).onClick      = OnClick;
     UIEventListener.Get(panel.consueBtn.gameObject).onClick     = OnClick;
     UIEventListener.Get(panel.materialBtn.gameObject).onClick   = OnClick;
     UIEventListener.Get(panel.gemBtn.gameObject).onClick        = OnClick;
     UIEventListener.Get(panel.addBagBtn.gameObject).onClick     = OnClick;
     UIEventListener.Get(panel.batchSellBtn.gameObject).onClick  = OnClick;
     UIEventListener.Get(panel.oKSellBtn.gameObject).onClick     = OnClick;
     UIEventListener.Get(panel.cancelSellBtn.gameObject).onClick = OnClick;
     UIEventListener.Get(panel.yesSellBtn.gameObject).onClick    = OnClick;
     UIEventListener.Get(panel.noSellBtn.gameObject).onClick     = OnClick;
     LongClickEvent.Get(panel.addBtn.gameObject).onPress         = OnPress;
     LongClickEvent.Get(panel.addBtn.gameObject).duration        = 2;
     LongClickEvent.Get(panel.subtractBtn.gameObject).onPress    = OnPress;
     LongClickEvent.Get(panel.subtractBtn.gameObject).duration   = 2;
     UIEventListener.Get(panel.minBtn.gameObject).onClick        = OnClick;
     UIEventListener.Get(panel.maxBtn.gameObject).onClick        = OnClick;
     UIEventListener.Get(panel.yesAddSize.gameObject).onClick    = OnClick;
     UIEventListener.Get(panel.noAddSize.gameObject).onClick     = OnClick;
 }
Пример #10
0
    /// <summary>
    /// 界面显示时调用
    /// </summary>
    protected override void OnShow(INotification notification)
    {
        if (panelType == PanelType.Info || panelType == PanelType.Sell || panelType == PanelType.Use)
        {
            m_Panel.CloseBtn.transform.localPosition = new Vector3(323, 244, 0);
            m_Panel.itemInfo.gameObject.SetActive(true);
            itemIcon  = m_Panel.transform.FindChild("itemInfo/itemIcon").GetComponent <UITexture>();
            itemcolor = m_Panel.transform.FindChild("itemInfo/itemcolor").GetComponent <UISprite>();
            itemName  = m_Panel.transform.FindChild("itemInfo/itemName").GetComponent <UILabel>();
            ShowItemInfo showItemInfo = (notification.Body as List <object>)[0] as ShowItemInfo;
            itemID = (notification.Body as List <object>)[1] as string;
            string uuid = (notification.Body as List <object>)[2] as string;
            item = ItemManager.GetItemInfo(itemID);
            EquipItemInfo equip = EquipConfig.GetEquipDataByUUID(uuid);
            if (equip != null)
            {
                itemcolor.spriteName = UtilTools.StringBuilder("color", equip.star);
            }
            else
            {
                itemcolor.spriteName = UtilTools.StringBuilder("color", item.color);
            }
            itemName.text = TextManager.GetItemString(item.itemID);
            LoadSprite.LoaderItem(itemIcon, itemID, false);
            if (panelType == PanelType.Info)
            {
                m_Panel.SellOne.gameObject.SetActive(false);
                m_Panel.Info.gameObject.SetActive(true);
                sellBtn    = m_Panel.transform.FindChild("itemInfo/Info/sellBtn").GetComponent <UIButton>();
                useItemBtn = m_Panel.transform.FindChild("itemInfo/Info/useItemBtn").GetComponent <UIButton>();
                itemDesc   = m_Panel.transform.FindChild("itemInfo/Info/itemDesc").GetComponent <UILabel>();
                itemPrice  = m_Panel.transform.FindChild("itemInfo/Info/itemPrice").GetComponent <UILabel>();
                itemNum    = m_Panel.transform.FindChild("itemInfo/Info/itemNum").GetComponent <UILabel>();
                UIEventListener.Get(sellBtn.gameObject).onClick    = OnClick;
                UIEventListener.Get(useItemBtn.gameObject).onClick = OnClick;
                if (item == null)
                {
                    return;
                }
                itemDesc.text  = TextManager.GetPropsString("description_" + item.itemID);
                itemPrice.text = item.itemPrice.ToString();
                itemNum.text   = ItemManager.GetBagItemCount(itemID.ToString()).ToString();
                sellItem       = showItemInfo.sellItem;
                useItem        = showItemInfo.useItem;
                if (sellItem == null && useItem == null)
                {
                    sellBtn.gameObject.SetActive(false);
                    useItemBtn.gameObject.SetActive(false);
                }
                else
                {
                    sellBtn.gameObject.SetActive(true);
                    useItemBtn.gameObject.SetActive(true);
                    sellItem = showItemInfo.sellItem;
                    useItem  = showItemInfo.useItem;
                }
            }
            else if (panelType == PanelType.Sell)
            {
                m_Panel.Info.gameObject.SetActive(false);
                m_Panel.SellOne.gameObject.SetActive(true);
                minBtn           = m_Panel.transform.FindChild("itemInfo/SellOne/minBtn").GetComponent <UIButton>();
                maxBtn           = m_Panel.transform.FindChild("itemInfo/SellOne/maxBtn").GetComponent <UIButton>();
                addBtn           = m_Panel.transform.FindChild("itemInfo/SellOne/addBtn").GetComponent <UIButton>();
                subtractBtn      = m_Panel.transform.FindChild("itemInfo/SellOne/subtractBtn").GetComponent <UIButton>();
                cancelOneSellBtn = m_Panel.transform.FindChild("itemInfo/SellOne/cancelOneSellBtn").GetComponent <UIButton>();
                okOneSellBtn     = m_Panel.transform.FindChild("itemInfo/SellOne/okOneSellBtn").GetComponent <UIButton>();
                haveNum          = m_Panel.transform.FindChild("itemInfo/SellOne/haveNum").GetComponent <UILabel>();
                changeNum        = m_Panel.transform.FindChild("itemInfo/SellOne/changeNum").GetComponent <UILabel>();
                sellPrcie        = m_Panel.transform.FindChild("itemInfo/SellOne/sellPrcie").GetComponent <UILabel>();
                UIEventListener.Get(cancelOneSellBtn.gameObject).onClick = OnClick;
                LongClickEvent.Get(subtractBtn.gameObject).onPress       = OnPress;
                LongClickEvent.Get(subtractBtn.gameObject).duration      = 3;
                LongClickEvent.Get(addBtn.gameObject).onPress            = OnPress;
                LongClickEvent.Get(addBtn.gameObject).duration           = 3;
                UIEventListener.Get(minBtn.gameObject).onClick           = OnClick;
                UIEventListener.Get(maxBtn.gameObject).onClick           = OnClick;
                UIEventListener.Get(okOneSellBtn.gameObject).onClick     = OnClick;
                subtractBtn.gameObject.SetActive(info.amount > 1);
                addBtn.gameObject.SetActive(info.amount > 1);
                maxBtn.gameObject.SetActive(info.amount > 1);
                minBtn.gameObject.SetActive(info.amount > 1);
                changeNum.gameObject.SetActive(info.amount > 1);
                changeNum.text = "1";
                sellPrcie.text = item.itemPrice.ToString();
                haveNum.text   = info.amount.ToString();
                SellOne        = showItemInfo.sellOne;
            }
            else if (panelType == PanelType.Use)
            {
                sellBtn    = m_Panel.transform.FindChild("itemInfo/Info/sellBtn").GetComponent <UIButton>();
                useItemBtn = m_Panel.transform.FindChild("itemInfo/Info/useItemBtn").GetComponent <UIButton>();
                itemDesc   = m_Panel.transform.FindChild("itemInfo/Info/itemDesc").GetComponent <UILabel>();
                itemPrice  = m_Panel.transform.FindChild("itemInfo/Info/itemPrice").GetComponent <UILabel>();
                itemNum    = m_Panel.transform.FindChild("itemInfo/Info/itemNum").GetComponent <UILabel>();
                sellBtn.gameObject.SetActive(false);
                useItemBtn.gameObject.SetActive(false);
                m_Panel.Info.gameObject.SetActive(true);
                m_Panel.use.gameObject.SetActive(true);
                if (item == null)
                {
                    return;
                }
                itemDesc.text  = TextManager.GetPropsString("description_" + item.itemID);
                itemPrice.text = item.itemPrice.ToString();
                itemNum.text   = info.amount.ToString();
                okuse          = m_Panel.transform.FindChild("itemInfo/use/okuse").GetComponent <UIButton>();
                cancelUse      = m_Panel.transform.FindChild("itemInfo/use/cancelUse").GetComponent <UIButton>();
                UIEventListener.Get(okuse.gameObject).onClick     = OnClick;
                UIEventListener.Get(cancelUse.gameObject).onClick = OnClick;
                UseOne = showItemInfo.useOne;
            }
        }
        else if (panelType == PanelType.Reward)
        {
            rewardIndex = 0;
            m_Panel.Mask.GetComponent <BoxCollider>().enabled    = false;
            UIEventListener.Get(m_Panel.Mask.gameObject).onClick = OnClick;
            m_Panel.CloseBtn.gameObject.SetActive(false);
            GameObject cell = m_Panel.RewardItem.gameObject;
            PoolManager.CreatePrefabPools(PoolManager.PoolKey.Prefab_RewardItem, cell, false);
            m_Panel.getReward.gameObject.SetActive(true);
            rewardList = notification.Body as List <object>;
            TimerManager.Destroy("rewardIndex");
            TimerManager.AddTimer("rewardIndex", 0.02f, CreateRewardItem);
            //getRewardBtn = m_Panel.transform.FindChild("getReward/getRewardBtn").GetComponent<UIButton>();
            //UIEventListener.Get(getRewardBtn.gameObject).onClick = OnClick;
        }
        else if (panelType == PanelType.ChooseFriend)
        {
            if (FriendMediator.friendList.Count < 1)
            {
                GUIManager.SetPromptInfo(TextManager.GetUIString("UI2048"), null);
                ClosePanel(null);
                return;
            }
            m_Panel.CloseBtn.transform.localPosition = new Vector3(374, 229, 0);
            m_Panel.chooseFriend.gameObject.SetActive(true);

            FriendGrid         = UtilTools.GetChild <UIGrid>(m_Panel.transform, "chooseFriend/ScrollView/FriendGrid");
            FriendGrid.enabled = true;
            FriendGrid.BindCustomCallBack(UpdateFriendGrid);
            FriendGrid.StartCustom();
        }
        else if (panelType == PanelType.UpMentality)
        {
            m_Panel.CloseBtn.transform.localPosition = new Vector3(316, 277, 0);
            UPMentality    = UtilTools.GetChilds <UIToggle>(m_Panel.transform, "ballerUpMentality/group");
            mentalityDesc  = UtilTools.GetChilds <UILabel>(m_Panel.transform, "ballerUpMentality/group");
            UPMentalityBtn = m_Panel.transform.FindChild("ballerUpMentality/UPMentalityBtn").GetComponent <UISprite>();
            UIEventListener.Get(UPMentalityBtn.gameObject).onClick = OnClick;
            m_Panel.ballerUpMentality.gameObject.SetActive(true);
        }
        else if (panelType == PanelType.SwitchInherit)
        {
            m_Panel.CloseBtn.transform.localPosition = new Vector3(378, 243, 0);
            m_Panel.switchballer.gameObject.SetActive(true);
            List <object> list = notification.Body as List <object>;
            ChooseGrid         = UtilTools.GetChild <UIGrid>(m_Panel.transform, "switchballer/ScrollView/ChooseGrid");
            ChooseGrid.enabled = true;
            ChooseGrid.BindCustomCallBack(UpdateInheriter);
            ChooseGrid.StartCustom();
            ChooseGrid.AddCustomDataList(list);
        }
    }
Пример #11
0
    void OnPress(GameObject go, bool isPressed)
    {
        if (!isPressed)
        {
            LongClickEvent.Get(go).time = 0;
        }
        int number = 0;
        int amount = 0;

        if (go == panel.addBtn.gameObject)
        {
            amount = int.Parse(panel.changeNum.text);
            if (shopItemInfo.moneyType == 3)
            {
                number = Mathf.FloorToInt(PlayerMediator.playerInfo.guildDonate / shopItemInfo.itemPrice);
                if (number >= shopItemInfo.limitTime)
                {
                    number = shopItemInfo.limitTime;
                }
                if (amount >= number)
                {
                    return;
                }
                amount++;
                panel.changeNum.text = amount.ToString();
                panel.buyPrcie.text  = (shopItemInfo.itemPrice * amount).ToString();
                return;
            }

            if (shopItemInfo.moneyType == 0)
            {
                number = Mathf.FloorToInt(PlayerMediator.playerInfo.diamond / (shopItemInfo.itemPrice * shopItemInfo.disCount / 100));
            }
            else if (shopItemInfo.moneyType == 1)
            {
                number = Mathf.FloorToInt(PlayerMediator.playerInfo.euro / (shopItemInfo.itemPrice * shopItemInfo.disCount / 100));
            }
            else
            {
                number = Mathf.FloorToInt(PlayerMediator.playerInfo.blackMoney / (shopItemInfo.itemPrice * shopItemInfo.disCount / 100));
            }

            if (ItemManager.GetShopItemInfo(shopItemInfo.itemID).limitTime != 0 && number > ItemManager.GetShopItemInfo(shopItemInfo.itemID).limitTime)
            {
                number = ItemManager.GetShopItemInfo(shopItemInfo.itemID).limitTime;
            }
            if (amount >= number)
            {
                return;
            }
            amount++;
            panel.changeNum.text = amount.ToString();
            panel.buyPrcie.text  = (shopItemInfo.itemPrice * amount * (shopItemInfo.disCount * 1.0f / 100)).ToString();
        }
        else
        {
            amount = int.Parse(panel.changeNum.text);
            if (amount <= 1)
            {
                return;
            }
            amount--;
            panel.changeNum.text = amount.ToString();
            panel.buyPrcie.text  = (shopItemInfo.itemPrice * amount * (shopItemInfo.disCount * 1.0f / 100)).ToString();
        }
    }