Example #1
0
        //刷新模型
        void showAvatar(int id, int quality = 0)
        {
            now_id = id;
            for (int j = 0; j < lsts_nine_region.Count; j++)
            {
                lst_avatars[j].SetActive(false);
                lsts_nine_region[j].transform.FindChild("icon/this").gameObject.SetActive(false);
            }
            lsts_nine_region[id - 1].transform.FindChild("icon/this").gameObject.SetActive(true);

            if (haveOrnoHalllow(id))
            {
                lst_avatars[id - 1].SetActive(true);
                model         = lst_avatars[id - 1];
                model_old_pos = avatars_old_position[id - 1];
                show_infos(id, A3_HallowsModel.getInstance().now_hallows()[id]);
                show_attribute(id, A3_HallowsModel.getInstance().now_hallows()[id]);
                divine_soul_nums(A3_HallowsModel.getInstance().now_hallows()[id].lvl, A3_HallowsModel.getInstance().now_hallows()[id].exp);
            }
            else
            {
                model = null;
                // model_old_pos = Vector3.zero;
            }
            obj_have_panel.SetActive(haveOrnoHalllow(id) ? true : false);
            obj_nohave_panel.SetActive(haveOrnoHalllow(id) ? false : true);
        }
Example #2
0
        //9个位置icon的创建
        void creatrveicon(int id)
        {
            Dictionary <int, hallowsData> dic = A3_HallowsModel.getInstance().now_hallows();

            GameObject iconf = lsts_nine_region[id - 1].transform.FindChild("icon/icon").gameObject;
            GameObject icon  = IconImageMgr.getInstance().createA3ItemIcon((uint)dic[id].item_id, true, -1, 1, true);

            icon.transform.SetParent(iconf.transform, false);

            Text   name      = lsts_nine_region[id - 1].transform.FindChild("name").GetComponent <Text>();
            string item_name = XMLMgr.instance.GetSXML("item.item", "id==" + (uint)dic[id].item_id).getString("item_name");

            name.text = Globle.getColorStrByQuality(item_name, dic[id].h_s_d.quality);

            a3_BagItemData data = new a3_BagItemData();

            data.tpid = (uint)dic[id].item_id;
            data.num  = 1;
            a3_ItemData da = new a3_ItemData();

            da             = a3_BagModel.getInstance().getItemDataById(data.tpid);
            data.confdata  = da;
            data.ishallows = true;
            new BaseButton(icon.transform).onClick = delegate(GameObject go) { this.itemOnclick(icon, data, 3); ShoworHideModel(false); };
        }
Example #3
0
        void onecompare(int type, uint tpid, int qua)
        {
            // Debug.LogError("我当前的位置是:" + type + "我的id是:" + tpid);
            Dictionary <int, hallowsData> dic_selfs = A3_HallowsModel.getInstance().now_hallows();


            if (dic_selfs != null)
            {
                if (dic_selfs.ContainsKey(type))
                {
                    if (dic_selfs[type].item_id == 0)
                    {
                        PutOrDown = true;
                        A3_HallowsProxy.getInstance().SendHallowsProxy(4, type, (int)tpid);
                        ischange = true;
                    }
                    else
                    {
                        if (dic_selfs[type].h_s_d.quality < qua)
                        {
                            PutOrDown = true;
                            A3_HallowsProxy.getInstance().SendHallowsProxy(4, type, (int)tpid);
                            ischange = true;
                        }
                    }
                }
            }
        }
Example #4
0
 //刷新属性
 void show_attribute(int id, hallowsData data)
 {
     for (int i = 0; i < lsts_attributes.Count; i++)
     {
         int   attribute_name  = A3_HallowsModel.getInstance().GetAttributeForQuality(data.h_s_d.quality)[i].Keys.ElementAt(0);//字典key的下标
         float attribute_value = A3_HallowsModel.getInstance().GetAttributeForQuality(data.h_s_d.quality)[i][attribute_name];
         lsts_attributes[i].GetComponent <Text>().text = Globle.getAttrAddById(attribute_name, (int)((attribute_value + attribute_value * data.lvl * 0.1f)) + 1);
     }
 }
Example #5
0
 //现在的身上是否有穿戴
 public bool haveOrnoHalllow(int id)
 {
     if (A3_HallowsModel.getInstance().now_hallows() != null && A3_HallowsModel.getInstance().now_hallows().ContainsKey(id) && A3_HallowsModel.getInstance().now_hallows()[id].item_id != 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #6
0
        void toallwear()
        {
            l.Clear();
            Dictionary <uint, a3_BagItemData> dic_bag = a3_BagModel.getInstance().getHallows();

            foreach (a3_BagItemData data in dic_bag.Values)
            {
                l.Add(data);
            }


            if (l.Count <= 0)
            {
                return;
            }

            l.Sort((a, b) => a.confdata.quality.CompareTo(b.confdata.quality));

            l.Sort((a, b) => a.confdata.tpid.CompareTo(b.confdata.tpid));

            int nowtype = 1;

            for (int i = 0; i < l.Count; i++)
            {
                int  qua  = l[i].confdata.quality;
                uint tpid = l[i].tpid;
                int  type = A3_HallowsModel.getInstance().GetTypeByItemid((int)tpid);

                print("位置:" + type + "id是:" + tpid + "品质是:" + qua);

                if (i < l.Count - 1)
                {
                    if (A3_HallowsModel.getInstance().GetTypeByItemid((int)l[i + 1].tpid) == nowtype)
                    {
                        continue;
                    }
                    else
                    {
                        onecompare(type, l[i].tpid, qua);
                        nowtype = A3_HallowsModel.getInstance().GetTypeByItemid((int)l[i + 1].tpid);
                    }
                }
                else
                {
                    onecompare(type, l[i].tpid, qua);
                }
            }
            if (!ischange)
            {
                flytxt.instance.fly(ContMgr.getCont("a3_hallowallwear"));
            }
            ischange = false;
        }
Example #7
0
        //刷新圣魂数量
        void divine_soul_nums()
        {
            string num = A3_HallowsModel.getInstance().GetSoulNum();

            mySoulNum.text     = num;
            mySoulNum_bag.text = num;
            if (int.Parse(num) <= 0)
            {
                devour_h.gameObject.GetComponent <Button>().interactable = false;
            }
            else
            {
                devour_h.gameObject.GetComponent <Button>().interactable = true;
            }
        }/*(背包界面,吞噬圣魂按钮)*/
Example #8
0
        void init_region()
        {
            Dictionary <int, hallowsData> dic = A3_HallowsModel.getInstance().now_hallows();

            if (dic == null)
            {
                return;
            }

            foreach (int i in dic.Keys)
            {
                if (dic[i].item_id == 0)
                {
                    continue;
                }
                else
                {
                    creatrveicon(dic[i].id);
                }
            }
        }
Example #9
0
        public void SendHallowsProxy(int res, int type = -1, int tpid = -1, List <Variant> lst = null)
        {
            Variant msg = new Variant();

            msg["op"] = res;
            switch (res)
            {
            case 1:
                break;

            case 2:
                msg["ware_type"] = type;
                msg["add_exp"]   = A3_HallowsModel.getInstance().soul_num;
                break;

            case 3:
                if (lst.Count <= 0)
                {
                    return;
                }
                msg["items"] = new Variant();
                for (int i = 0; i < lst.Count; i++)
                {
                    msg["items"].pushBack(lst[i]);
                }
                break;

            case 4:
                msg["tpid"]      = tpid;
                msg["ware_type"] = type;
                break;

            case 10:
                break;

            default:
                break;
            }
            sendRPC(PKG_NAME.C2S_A3_HALLOWS, msg);
        }
Example #10
0
        void compose_halloews(int id, bool havehallows)
        {
            Dictionary <uint, a3_BagItemData> dic_bag  = a3_BagModel.getInstance().getHallows();
            Dictionary <int, hallowsData>     dic_self = A3_HallowsModel.getInstance().now_hallows();

            foreach (a3_BagItemData data in dic_bag.Values)
            {
                if (A3_HallowsModel.getInstance().GetTypeByItemid((int)data.confdata.tpid) == id)
                {
                    if (havehallows)
                    {
                        if (data.confdata.quality <= dic_self[id].h_s_d.quality)
                        {
                            Variant hci = new Variant();
                            hci["item_id"]  = data.tpid;
                            hci["item_num"] = data.num;
                            lst_bag.Add(hci);
                        }
                        else
                        {
                            lst_bid.Add(data);
                        }
                    }
                    else
                    {
                        lst_bid.Add(data);
                    }
                }
            }
            if (lst_bid.Count > 0)
            {
                //lst_bid.OrderBy(c=>c.confdata.quality);
                lst_bid.Sort((a, b) => a.confdata.quality.CompareTo(b.confdata.quality));


                Lst_bag(lst_bid);
            }
        }
Example #11
0
        //背包里要分解的圣器
        void composeallhallows()
        {
            Dictionary <uint, a3_BagItemData> dic_bag  = a3_BagModel.getInstance().getHallows();
            Dictionary <int, hallowsData>     dic_self = A3_HallowsModel.getInstance().now_hallows();

            if (dic_bag.Count <= 0)
            {
                return;
            }

            for (int i = 1; i <= dic_self.Keys.Count; i++)
            {
                if (dic_self[i].item_id != 0)
                {
                    //有穿
                    compose_halloews(i, true);
                }
                else
                {
                    compose_halloews(i, false);
                    //身上没穿
                }
            }
        }
Example #12
0
        //刷新信息
        void show_infos(int id, hallowsData data)
        {
            Dictionary <int, hallowsData> dic = A3_HallowsModel.getInstance().now_hallows();

            Text nameandlv = getComponentByPath <Text>("right_bg/have/panels/info/nameandlv");

            nameandlv.text = a3_BagModel.getInstance().getItemDataById((uint)data.item_id).item_name + "LV:" + data.lvl;


            GameObject iconf = getGameObjectByPath("right_bg/have/panels/info/icon/icon");

            iconf.GetComponent <Image>().sprite = GAMEAPI.ABUI_LoadSprite("icon_holic_skill_" + data.h_s_d.skill_id);
            //GameObject icon = IconImageMgr.getInstance().createA3ItemIcon((uint)data.h_s_d.skill_id);
            //icon.transform.SetParent(iconf.transform, false);


            Text skill_name = getComponentByPath <Text>("right_bg/have/panels/info/skill_name");

            skill_name.text = data.h_s_d.skill_name;

            Text des = getComponentByPath <Text>("right_bg/have/panels/info/skill_des");

            des.text = data.h_s_d.skill_des;
        }
 void onOut_chushou(GameObject go)
 {
     //圣器脱下
     if (item_data.ishallows)
     {
         if ((int)uiData[2] == 3)
         {
             int type = A3_HallowsModel.getInstance().GetTypeByItemid((int)item_data.tpid);//位置
             a3_hallows.instance.PutOrDown = false;
             A3_HallowsProxy.getInstance().SendHallowsProxy(4, type, 0);
             InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
             if (a3_hallows.instance)
             {
                 a3_hallows.instance.ShoworHideModel(true);
             }
             return;
         }
     }
     if (piliang_chushou.instance)
     {
         piliang_chushou.instance.outItem_chushou(curid, cur_num);
     }
     InterfaceMgr.getInstance().close(InterfaceMgr.A3_ITEMTIP);
 }
        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);
        }
        void initItemInfo()
        {
            Transform info = transform.FindChild("info");

            for (int i = 1; i <= 6; i++)
            {
                if (i == item_data.confdata.quality)
                {
                    info.FindChild("ig_bg/" + i).gameObject.SetActive(true);
                }
                else
                {
                    info.FindChild("ig_bg/" + i).gameObject.SetActive(false);
                }
            }

            info.FindChild("name").GetComponent <Text>().text  = item_data.confdata.item_name;
            info.FindChild("name").GetComponent <Text>().color = Globle.getColorByQuality(item_data.confdata.quality);

            info.FindChild("desc").GetComponent <Text>().text = StringUtils.formatText(item_data.confdata.desc);

            //info.FindChild("num").GetComponent<Text>().text = item_data.num.ToString();

            if (item_data.confdata.use_limit > 0)
            {
                //info.FindChild("lv").gameObject.SetActive(true);
                //info.FindChild("text_lv").gameObject.SetActive(true);
                info.FindChild("lv").GetComponent <Text>().text = item_data.confdata.use_limit + ContMgr.getCont("zhuan") + item_data.confdata.use_lv + ContMgr.getCont("ji");
            }
            else
            {
                //info.FindChild("lv").gameObject.SetActive(false);
                //info.FindChild("text_lv").gameObject.SetActive(false);
                info.FindChild("lv").GetComponent <Text>().text = ContMgr.getCont("a3_active_wuxianzhi");
            }

            Transform Image = info.FindChild("icon");

            if (Image.childCount > 0)
            {
                Destroy(Image.GetChild(0).gameObject);
            }
            GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(item_data);

            icon.transform.SetParent(Image, false);

            num_bar.value = 0;
            cur_num       = 1;

            if (item_data.confdata.use_type > 0)
            {
                if (item_data.confdata.use_type == 19)
                {
                    transform.FindChild("info/use").GetComponent <Button>().interactable = false;
                }
                else
                {
                    //if (item_data.confdata.use_type != 21)
                    transform.FindChild("info/use").GetComponent <Button>().interactable = true;
                    //else
                    //{
                    //    if (item_data.confdata.use_sum_require <= a3_BagModel.getInstance().getItemNumByTpid(item_data.confdata.tpid))
                    //    {
                    //        transform.FindChild("info/use").GetComponent<Button>().interactable = true;
                    //    }
                    //    else
                    //        transform.FindChild("info/use").GetComponent<Button>().interactable = false;
                    //}
                }
            }
            else
            {
                transform.FindChild("info/use").GetComponent <Button>().interactable = false;
                ///是不是圣器
                if (item_data.ishallows)
                {
                    if ((int)uiData[2] == 2)
                    {
                        int type = A3_HallowsModel.getInstance().GetTypeByItemid((int)item_data.tpid);//位置
                        if (A3_HallowsModel.getInstance().now_hallows_dic.ContainsKey(type) && A3_HallowsModel.getInstance().now_hallows_dic[type].item_id == (int)item_data.tpid)
                        {
                            getComponentByPath <Button>("info/use").interactable = false;
                        }
                        else
                        {
                            getComponentByPath <Button>("info/use").interactable = true;
                        }
                    }
                    else
                    {
                        transform.FindChild("info/use").GetComponent <Button>().interactable = true;
                    }
                }
            }

            onNumChange(0);


            if (item_data.confdata.use_type == 13)
            {
                transform.FindChild("info/bodyNum/btn_reduce").gameObject.SetActive(false);
                transform.FindChild("info/bodyNum/btn_add").gameObject.SetActive(false);
                transform.FindChild("info/bodyNum/bug").gameObject.SetActive(false);
                transform.FindChild("info/bodyNum/min").gameObject.SetActive(false);
                transform.FindChild("info/bodyNum/max").gameObject.SetActive(false);
                transform.FindChild("info/bodyNum/donum").gameObject.SetActive(false);
            }
            else
            {
                transform.FindChild("info/bodyNum/btn_reduce").gameObject.SetActive(true);
                transform.FindChild("info/bodyNum/btn_add").gameObject.SetActive(true);
                transform.FindChild("info/bodyNum/bug").gameObject.SetActive(true);
                transform.FindChild("info/bodyNum/min").gameObject.SetActive(true);
                transform.FindChild("info/bodyNum/max").gameObject.SetActive(true);
                transform.FindChild("info/bodyNum/donum").gameObject.SetActive(true);
            }
        }
Example #16
0
        void onLoadHallows(Variant data)
        {
            debug.Log("受到圣器的协议:" + data.dump());
            int res = data["res"];

            switch (res)
            {
            case 1:    //其实是发了九个位置的信息,没发的就是默认等级(item_id是不是为0判断身上有没有穿东西)
                A3_HallowsModel.getInstance().soul_num = data["soul_num"];
                if (data["ware_lvl"].Count > 0)
                {
                    for (int i = 0; i < data["ware_lvl"].Count; i++)
                    {
                        hallowsData hd = new hallowsData();
                        hd.id      = data["ware_lvl"][i]["soul_type"]._int;
                        hd.item_id = data["ware_lvl"][i]["ware_tpid"]._int;
                        hd.lvl     = data["ware_lvl"][i]["soul_lvl"]._int;
                        hd.exp     = data["ware_lvl"][i]["soul_exp"]._int;
                        hallows_skill_data hsd = new hallows_skill_data();
                        if (hd.item_id != 0)
                        {
                            hsd      = A3_HallowsModel.getInstance().GetHallowsSkillData(hd.id, hd.item_id);
                            hd.h_s_d = hsd;
                        }
                        A3_HallowsModel.getInstance().now_hallows_dic[hd.id] = hd;
                    }
                }
                break;

            case 2:
                A3_HallowsModel.getInstance().soul_num = data["soul_num"];
                hallowsData hds = new hallowsData();
                hds.id      = data["soul_info"]["soul_type"]._int;
                hds.item_id = data["soul_info"]["ware_tpid"]._int;
                hds.lvl     = data["soul_info"]["soul_lvl"]._int;
                hds.exp     = data["soul_info"]["soul_exp"]._int;
                hallows_skill_data hsds = new hallows_skill_data();
                hsds      = A3_HallowsModel.getInstance().GetHallowsSkillData(hds.id, hds.item_id);
                hds.h_s_d = hsds;
                A3_HallowsModel.getInstance().now_hallows_dic[hds.id] = hds;
                if (a3_hallows.instance)
                {
                    a3_hallows.instance.UpgradeHallows(hds.id, hds);
                }
                break;

            case 3:
                A3_HallowsModel.getInstance().soul_num = data["soul_num"];
                if (a3_hallows.instance.AllCompose)
                {
                    a3_hallows.instance.DecomposeHallows();
                }
                else
                {
                    a3_hallows.instance.DecomposeHallows(a3_hallows.instance.this_tpid);
                }
                break;

            case 4:
                if (a3_hallows.instance)
                {
                    if (a3_hallows.instance.PutOrDown)
                    {
                        A3_HallowsModel.getInstance().now_hallows_dic[data["soul_type"]].item_id = data["ware_tpid"];
                        A3_HallowsModel.getInstance().now_hallows_dic[data["soul_type"]].h_s_d   = A3_HallowsModel.getInstance().GetHallowsSkillData(data["soul_type"], data["ware_tpid"]);
                        a3_hallows.instance.PutHallows(data["soul_type"], data["ware_tpid"]);
                    }
                    else
                    {
                        A3_HallowsModel.getInstance().now_hallows_dic[data["soul_type"]].item_id = 0;
                        a3_hallows.instance.DownHallows(data["soul_type"]);
                    }
                }


                break;

            case 10:
                if (data["tf"]._int == 0)
                {
                    //不显示
                    A3_HallowsModel.type_duihuan = 0;
                }
                else if (data["tf"]._int == 1)
                {
                    //显示
                    A3_HallowsModel.type_duihuan = 1;
                }
                break;

            default:
                Globle.err_output(res);
                return;
            }
        }