public override void onClosed()
        {
            petmodel.OnExpChange        -= OnExpChange;
            petmodel.OnStarvationChange -= OnStarvationChange;
            //petmodel.OnAutoFeedChange -= OnAutoFeedChange;
            //petmodel.Onauto_buyChange -= OnAutoBuyChange;
            petmodel.OnLevelChange -= OnLevelChange;
            petmodel.OnStageChange -= OnStageChange;

            BagProxy.getInstance().removeEventListener(BagProxy.EVENT_ITEM_CHANGE, OnPetItemChange);

            if (petTexture != null)
            {
                GameObject.Destroy(petTexture);
                petTexture = null;
            }
            if (avatarCamera != null)
            {
                GameObject.Destroy(avatarCamera);
                avatarCamera = null;
            }
            if (pet != null)
            {
                GameObject.Destroy(pet);
                pet = null;
            }
        }
        public override void onShowed()
        {
            A3_PetProxy.getInstance().GetPets();
            petmodel.OnExpChange += OnExpChange;
            //petmodel.OnStarvationChange += OnStarvationChange;
            // petmodel.OnAutoFeedChange += OnAutoFeedChange;
            petmodel.OnAutoFeedChange -= OnAutoBuyChange;
            petmodel.OnLevelChange    += OnLevelChange;
            petmodel.OnStageChange    += OnStageChange;

            OnExpChange();
            OnStarvationChange();
            OnAutoFeedChange();
            OnAutoBuyChange();
            OnLevelChange();
            OnStageChange();
            OnPetItemChange(null);

            BagProxy.getInstance().addEventListener(BagProxy.EVENT_ITEM_CHANGE, OnPetItemChange);

            //if (petmodel.Starvation < 20)
            //{
            //    String hint = ContMgr.getCont("pet_hungry");
            //    flytxt.instance.fly(hint);
            //}
        }
 void onOpenLock(GameObject go)
 {
     transform.FindChild("panel_open").gameObject.SetActive(false);
     if (isbag_open)
     {
         if (open_choose_tag == 1)
         {
             BagProxy.getInstance().sendOpenLock(2, cur_num, true);
         }
         else
         {
             BagProxy.getInstance().sendOpenLock(2, cur_num, false);
         }
     }
     else
     {
         if (open_choose_tag == 1)
         {
             BagProxy.getInstance().sendOpenLock(3, cur_num, true);
         }
         else
         {
             BagProxy.getInstance().sendOpenLock(3, cur_num, false);
         }
     }
 }
 public override void onClosed()
 {
     InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_NORMAL);
     GRMap.GAME_CAMERA.SetActive(true);
     BagProxy.getInstance().removeEventListener(BagProxy.EVENT_ITEM_CHANGE, onItemChange);
     BagProxy.getInstance().removeEventListener(BagProxy.EVENT_OPEN_BAGLOCK, onOpenBagLockRec);
     BagProxy.getInstance().removeEventListener(BagProxy.EVENT_OPEN_HOUSELOCK, onOpenHouseLockRec);
     BagProxy.getInstance().removeEventListener(BagProxy.EVENT_ROOM_TURN, onRoomTurn);
     UIClient.instance.removeEventListener(UI_EVENT.ON_MONEY_CHANGE, onMoneyChange);
     foreach (GameObject go in itemicon.Values)
     {
         Destroy(go);
     }
     itemicon.Clear();
     foreach (GameObject go in houseicon.Values)
     {
         Destroy(go);
     }
     houseicon.Clear();
     if (a3_bag.indtans)
     {
         if (a3_bag.indtans.isbagToCK)
         {
             InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_BAG);
             a3_bag.indtans.isbagToCK = false;
         }
     }
 }
        public override void onShowed()
        {
            InterfaceMgr.getInstance().changeState(InterfaceMgr.STATE_FUNCTIONBAR);
            GRMap.GAME_CAMERA.SetActive(false);
            BagProxy.getInstance().addEventListener(BagProxy.EVENT_ITEM_CHANGE, onItemChange);
            BagProxy.getInstance().addEventListener(BagProxy.EVENT_OPEN_BAGLOCK, onOpenBagLockRec);
            BagProxy.getInstance().addEventListener(BagProxy.EVENT_OPEN_HOUSELOCK, onOpenHouseLockRec);
            BagProxy.getInstance().addEventListener(BagProxy.EVENT_ROOM_TURN, onRoomTurn);
            UIClient.instance.addEventListener(UI_EVENT.ON_MONEY_CHANGE, onMoneyChange);
            onOpenBagLockRec(null);
            onOpenHouseLockRec(null);
            refreshGold();
            refreshGift();
            refreshMoney();
            onLoadItem();
            open_choose_tag = 1;
            for (int i = 1; i <= 2; i++)
            {
                Toggle tog = transform.FindChild("panel_open/open_choose/Toggle" + i).GetComponent <Toggle>();
                if (i == open_choose_tag)
                {
                    tog.isOn = true;
                }
                else
                {
                    tog.isOn = false;
                }
            }

            transform.FindChild("auto").GetComponent <Toggle>().isOn = false;
            is_auto = false;
        }
        private void OnAddBtnOnClick()
        {
            _btnYes.onClick = (go) => {
                bool isContainKeyWord = KeyWord.isContain(_content.text);

                if (isContainKeyWord)
                {
                    flytxt.instance.fly(ContMgr.getCont("changeName_ErrContent"));

                    return;
                }

                if ((int)this.uiData[0] == 1)
                {
                    BagProxy.getInstance().sendUseItems((uint)this.uiData[1], 1, _content.text);
                }

                else if ((int)this.uiData[0] == 2)
                {
                    if (changeLegionName != null)
                    {
                        changeLegionName(_content.text);
                    }
                }
            };

            _btnClose.onClick = (go) =>
            {
                InterfaceMgr.getInstance().close(InterfaceMgr.A3_CHANGE_NAME);
            };
        }
Beispiel #7
0
 //开始出售
 void SellItem(GameObject go)
 {
     dic_Itemlist.Clear();
     foreach (uint i in dic_BagItem_shll.Keys)
     {
         Variant item = new Variant();
         item["id"]  = i;
         item["num"] = dic_BagItem_shll[i].num;
         dic_Itemlist.Add(item);
     }
     BagProxy.getInstance().sendSellItems(dic_Itemlist);
 }
 void onput(GameObject go)
 {
     InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
     if (is_put_in)
     {
         BagProxy.getInstance().sendRoomItems(true, curid, cur_num);
     }
     else
     {
         BagProxy.getInstance().sendRoomItems(false, curid, cur_num);
     }
 }
Beispiel #9
0
        public void AutoEquipProcess(a3_BagItemData itmdata)
        {
            AutoPlayModel apmodel = AutoPlayModel.getInstance();

            //!--非自动挂机不做处理
            if (!SelfRole.fsm.Autofighting)
            {
                return;
            }

            //!--不处理装备,或vip等级3以下
            if (apmodel.EqpType == 0 || A3_VipModel.getInstance().Level < 3)
            {
                return;
            }

            int eqpproc = apmodel.EqpProc;
            int quality = itmdata.confdata.quality;
            int bitqual = (1 << (quality - 1));

            if ((eqpproc & bitqual) == 0)
            {
                return;
            }

            if (apmodel.EqpType == 1)
            {//!--自动出售
                BagProxy.getInstance().sendSellItems(itmdata.id, itmdata.num);


                flytxt.instance.fly(ContMgr.getCont("StatePick0") + Globle.getColorStrByQuality(itmdata.confdata.item_name, itmdata.confdata.quality));
            }
            else if (apmodel.EqpType == 2)
            {//!--自动分解
                List <uint> eqps = new List <uint>();
                eqps.Add(itmdata.id);
                EquipProxy.getInstance().sendsell(eqps);

                flytxt.instance.fly(ContMgr.getCont("StatePick1") + Globle.getColorStrByQuality(itmdata.confdata.item_name, itmdata.confdata.quality));
            }
        }
 void onsell(GameObject go)
 {
     //圣器分解
     if (item_data.ishallows)
     {
         if ((int)uiData[2] == 2)
         {
             a3_hallows.instance.AllCompose = false;
             a3_hallows.instance.this_tpid  = item_data.tpid;
             List <Variant> lst = new List <Variant>();
             Variant        hcj = new Variant();
             hcj["item_id"]  = item_data.tpid;
             hcj["item_num"] = cur_num;
             lst.Add(hcj);
             A3_HallowsProxy.getInstance().SendHallowsProxy(3, -1, -1, lst);
             InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
             return;
         }
     }
     InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
     BagProxy.getInstance().sendSellItems(curid, cur_num);
 }
Beispiel #11
0
 //出售
 void btn_sell_Onclick(GameObject go)
 {
     BagProxy.getInstance().sendSellItems(itemdata.id, 1);
     closeOnclick(go);
 }
        void ondo(GameObject go)
        {
            if (item_data.confdata.use_type == 21)
            {
                if (!FunctionOpenMgr.instance.Check(FunctionOpenMgr.SUMMON_MONSTER))
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_itemtip_lock"));
                    return;
                }

                ArrayList v = new ArrayList();
                v.Add("tujian");
                v.Add(item_data.confdata.zhSummon);
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SUMMON_NEW, v);
                if (closeWin != null)
                {
                    InterfaceMgr.getInstance().close(closeWin);
                    closeWin = null;
                    togo     = true;
                }
            }
            else if (item_data.confdata.use_type == 23)
            {
                if (!FunctionOpenMgr.instance.Check(FunctionOpenMgr.SUMMON_MONSTER))
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_itemtip_lock"));
                    return;
                }
                if (A3_SummonModel.getInstance().GetSummons().Count <= 0)
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_summon_unllSummon"));
                    return;
                }
                ArrayList v = new ArrayList();
                v.Add("shuxing");
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SUMMON_NEW, v);
                if (closeWin != null)
                {
                    InterfaceMgr.getInstance().close(closeWin);
                    closeWin = null;
                    togo     = true;
                }
            }
            else if (item_data.confdata.use_type == 24)
            {
                if (!FunctionOpenMgr.instance.Check(FunctionOpenMgr.SUMMON_MONSTER))
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_itemtip_lock"));
                    return;
                }
                if (A3_SummonModel.getInstance().GetSummons().Count <= 0)
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_summon_unllSummon"));
                    return;
                }
                ArrayList v = new ArrayList();
                v.Add("xilian");
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SUMMON_NEW, v);
                if (closeWin != null)
                {
                    InterfaceMgr.getInstance().close(closeWin);
                    closeWin = null;
                    togo     = true;
                }
            }
            else if (item_data.confdata.use_type == 25)
            {
                if (!FunctionOpenMgr.instance.Check(FunctionOpenMgr.SUMMON_MONSTER))
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_itemtip_lock"));
                    return;
                }
                if (A3_SummonModel.getInstance().GetSummons().Count <= 0)
                {
                    flytxt.instance.fly(ContMgr.getCont("a3_summon_unllSummon"));
                    return;
                }
                ArrayList v = new ArrayList();
                v.Add("shouhun");
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_SUMMON_NEW, v);
                if (closeWin != null)
                {
                    InterfaceMgr.getInstance().close(closeWin);
                    closeWin = null;
                    togo     = true;
                }
            }
            else if (item_data.confdata.use_type == 28)
            {
                ArrayList v = new ArrayList();
                v.Add(1);       // type    1 表示 人物修改   2   表示军团修改
                v.Add(curid);   // 道具id
                v.Add(cur_num); //道具使用数量
                InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_CHANGE_NAME, v);
            }
            //圣器装备
            else if (item_data.ishallows)
            {
                if ((int)uiData[2] == 2)
                {
                    int type = A3_HallowsModel.getInstance().GetTypeByItemid((int)item_data.tpid);//位置
                    if (a3_hallows.instance)
                    {
                        a3_hallows.instance.OldType_tpid = a3_hallows.instance.haveOrnoHalllow(type) ? (uint)A3_HallowsModel.getInstance().now_hallows()[type].item_id : 0;
                    }
                    a3_hallows.instance.PutOrDown = true;
                    A3_HallowsProxy.getInstance().SendHallowsProxy(4, type, (int)item_data.tpid);
                }
                else
                {
                    InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
                    InterfaceMgr.getInstance().close(InterfaceMgr.A3_BAG);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_HALLOWS);
                    return;
                }
            }
            else
            {
                BagProxy.getInstance().sendUseItems(curid, cur_num);
            }
            InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
        }
 private void onsell(GameObject go)
 {
     InterfaceMgr.getInstance().close(InterfaceMgr.A3TIPS_SUMMON);
     BagProxy.getInstance().sendSellItems(item_data.id, 1);
 }
        void onItemClick(GameObject go, uint id, bool ishouse)
        {
            a3_BagItemData one;

            if (ishouse)
            {//点击仓库
                one = a3_BagModel.getInstance().getHouseItems()[id];
                if (is_auto)
                {
                    if (nextid != id)
                    {
                        BagProxy.getInstance().sendRoomItems(false, one.id, one.num);
                        nextid = id;
                    }
                }
                else
                {
                    if (one.isEquip)
                    {
                        ArrayList data = new ArrayList();
                        data.Add(one);
                        data.Add(equip_tip_type.HouseOut_tip);
                        data.Add(this.uiName);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_EQUIPTIP, data);
                    }
                    else if (one.isSummon)
                    {
                        ArrayList data = new ArrayList();
                        data.Add(one);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3TIPS_SUMMON, data);
                    }
                    else
                    {
                        ArrayList data = new ArrayList();
                        data.Add(one);
                        data.Add(equip_tip_type.HouseOut_tip);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMTIP, data);
                    }
                }
            }
            else
            {//点击包裹
                one = a3_BagModel.getInstance().getItems()[id];
                if (is_auto && (a3_BagModel.getInstance().house_curi - a3_BagModel.getInstance().getHouseItems().Count) >= 1)
                {
                    if (nextid1 != id)
                    {
                        BagProxy.getInstance().sendRoomItems(true, one.id, one.num);
                        nextid1 = id;
                    }
                }
                else if (!is_auto)
                {
                    if (one.isNew)
                    {
                        one.isNew = false;
                        a3_BagModel.getInstance().addItem(one);
                        itemicon[id].transform.FindChild("iconborder/is_new").gameObject.SetActive(false);
                    }

                    if (one.isEquip)
                    {
                        ArrayList data = new ArrayList();
                        data.Add(one);
                        data.Add(equip_tip_type.HouseIn_tip);
                        data.Add(this.uiName);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_EQUIPTIP, data);
                    }
                    else if (one.isSummon)
                    {
                        ArrayList data = new ArrayList();
                        data.Add(one);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3TIPS_SUMMON, data);
                    }
                    else
                    {
                        ArrayList data = new ArrayList();
                        data.Add(one);
                        data.Add(equip_tip_type.HouseIn_tip);
                        InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMTIP, data);
                    }
                }
                else if ((a3_BagModel.getInstance().house_curi - a3_BagModel.getInstance().getHouseItems().Count) < 1)
                {
                    //flytxt.instance.fly(ContMgr.getCont("cangkuyiman"));

                    BagProxy.getInstance().sendRoomItems(true, one.id, one.num);
                }
            }
        }