void createItem()
        {
            Dictionary <a3_ItemData, uint> itemDataList = WelfareModel.getInstance().getFirstChargeDataList();

            foreach (KeyValuePair <a3_ItemData, uint> item in itemDataList)
            {
                a3_ItemData itemData = item.Key;
                if (item.Value == 0)
                {
                    GameObject con  = this.transform.FindChild("body/awardItems/item").gameObject;
                    GameObject clon = (GameObject)Instantiate(con);
                    clon.SetActive(true);
                    clon.transform.SetParent(content2d, false);
                    GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemData, true, -1, 0.9f);
                    icon.transform.SetParent(clon.transform, false);
                    new BaseButton(icon.transform).onClick = (GameObject go) =>
                    {
                        setTip(item.Key);
                    };
                    //LayoutElement le = icon.AddComponent<LayoutElement>();
                    //le.minHeight = 100.0f;
                    //le.minWidth = 100.0f;
                    //le.preferredHeight = 100.0f;
                    //le.preferredWidth = 100.0f;
                    icon.gameObject.SetActive(true);
                    //icon.transform.localScale = Vector3.one;
                }
            }
        }
Beispiel #2
0
        private void doGetExp(GameEvent e)
        {
            off_line_exp expr_06 = off_line_exp.instance;
            bool         flag    = expr_06 != null && expr_06.offline;

            if (flag)
            {
                bool flag2 = off_line_exp.instance.offline_item != null;
                if (flag2)
                {
                    foreach (a3_BagItemData current in off_line_exp.instance.offline_item)
                    {
                        a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.tpid);

                        GameObject showIcon = IconImageMgr.getInstance().createA3ItemIconTip(current.tpid, false, current.num, 1f, false, -1, 0, false, false, false);
                        flytxt.instance.fly(null, 6, default(Color), showIcon);
                    }
                }
                off_line_exp.instance.offline = false;
                off_line_exp.instance.offline_item.Clear();
            }
            Variant data = e.data;
            int     num  = data["res"];

            this.offLineModel.OffLineTime = 0;
            this.offLineModel.BaseExp     = 0;
            debug.Log("离线经验的服务器反馈" + e.data.dump());
            InterfaceMgr.getInstance().close(InterfaceMgr.OFFLINEEXP);
        }
Beispiel #3
0
        void SetView()
        {
            Transform Con = tranObj.transform.FindChild("View/scroll/content");

            shouhunObj.Clear();
            for (int i = 0; i < Con.childCount; i++)
            {
                GameObject.Destroy(Con.GetChild(i).gameObject);
            }
            GameObject  item     = tranObj.transform.FindChild("View/scroll/0").gameObject;
            List <SXML> SoulList = sumXml.GetNodeList("mon_soul");

            foreach (SXML Soul in SoulList)
            {
                GameObject clon = GameObject.Instantiate(item) as GameObject;
                clon.SetActive(true);
                clon.transform.SetParent(Con, false);
                clon.transform.FindChild("name").GetComponent <Text>().text = Soul.getString("name");
                int soulid = Soul.getInt("soul_id");
                new BaseButton(clon.transform.FindChild("todo")).onClick = (GameObject go) => {
                    A3_SummonProxy.getInstance().sendshouhun(CurSummonID, (uint)soulid, 1);
                };
                int         itemid = Soul.getInt("item_id");
                a3_ItemData data   = a3_BagModel.getInstance().getItemDataById((uint)itemid);
                GameObject  icon   = IconImageMgr.getInstance().createA3ItemIcon(data);
                icon.SetActive(true);
                icon.transform.SetParent(clon.transform.FindChild("todo/icon"), false);

                shouhunObj[soulid] = clon;
            }
        }
Beispiel #4
0
        public bool checkCanEquip(a3_ItemData data, int stage, int blessing_lv)
        {
            bool flag  = false;
            SXML sXML  = XMLMgr.instance.GetSXML("item.stage", "stage_level==" + stage);
            bool flag2 = sXML == null;
            bool result;

            if (flag2)
            {
                result = false;
            }
            else
            {
                sXML = sXML.GetNode("stage_info", "itemid==" + data.tpid);
                string[] array = sXML.getString("equip_limit1").Split(new char[]
                {
                    ','
                });
                string[] array2 = sXML.getString("equip_limit2").Split(new char[]
                {
                    ','
                });
                int  num   = int.Parse(array[1]) * (100 - 3 * blessing_lv) / 100;
                int  num2  = int.Parse(array2[1]) * (100 - 3 * blessing_lv) / 100;
                bool flag3 = num <= ModelBase <PlayerModel> .getInstance().attr_list[uint.Parse(array[0])] && num2 <= ModelBase <PlayerModel> .getInstance().attr_list[uint.Parse(array2[0])] && (long)stage <= (long)((ulong)ModelBase <PlayerModel> .getInstance().up_lvl);

                if (flag3)
                {
                    flag = true;
                }
                result = flag;
            }
            return(result);
        }
        private void createItem()
        {
            Dictionary <a3_ItemData, uint> firstChargeDataList = ModelBase <WelfareModel> .getInstance().getFirstChargeDataList();

            using (Dictionary <a3_ItemData, uint> .Enumerator enumerator = firstChargeDataList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <a3_ItemData, uint> item = enumerator.Current;
                    a3_ItemData key  = item.Key;
                    bool        flag = item.Value == 0u;
                    if (flag)
                    {
                        GameObject gameObject  = base.transform.FindChild("body/awardItems/item").gameObject;
                        GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(gameObject);
                        gameObject2.SetActive(true);
                        gameObject2.transform.SetParent(this.content2d, false);
                        GameObject gameObject3 = IconImageMgr.getInstance().createA3ItemIcon(key, true, -1, 0.9f, false, -1, 0, false, false, false, -1, false, false);
                        gameObject3.transform.SetParent(gameObject2.transform, false);
                        new BaseButton(gameObject3.transform, 1, 1).onClick = delegate(GameObject go)
                        {
                            this.setTip(item.Key, false);
                        };
                        gameObject3.gameObject.SetActive(true);
                    }
                }
            }
        }
Beispiel #6
0
        //获得服务器反馈
        void doGetExp(GameEvent e)
        {
            if (off_line_exp.instance?.offline == true)
            {
                if (off_line_exp.instance.offline_item != null)
                {
                    foreach (var v in off_line_exp.instance.offline_item)
                    {
                        a3_ItemData item1 = a3_BagModel.getInstance().getItemDataById((uint)v.tpid);
                        GameObject  go    = IconImageMgr.getInstance().createA3ItemIconTip(itemid: (uint)v.tpid, num: v.num);
                        flytxt.instance.fly(null, 6, showIcon: go);
                    }
                }
                off_line_exp.instance.offline = false;
                off_line_exp.instance.offline_item.Clear();
            }



            Variant data = e.data;
            int     res  = data["res"];

            offLineModel.OffLineTime = 0;
            offLineModel.BaseExp     = 0;
            debug.Log("离线经验的服务器反馈" + e.data.dump());
            InterfaceMgr.getInstance().close(InterfaceMgr.OFFLINEEXP);
        }
        void createEquip()
        {
            Dictionary <a3_ItemData, uint> itemDataList = WelfareModel.getInstance().getFirstChargeDataList();

            foreach (KeyValuePair <a3_ItemData, uint> item in itemDataList)
            {
                a3_ItemData itemData = item.Key;
                if (item.Value != 0)
                {
                    if (item.Value == (uint)PlayerModel.getInstance().profession)
                    {
                        GameObject con  = this.transform.FindChild("body/awardItems/equip").gameObject;
                        GameObject clon = (GameObject)Instantiate(con);
                        clon.SetActive(true);
                        clon.transform.SetParent(content2d, false);
                        GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemData, true);
                        icon.transform.FindChild("iconborder").gameObject.SetActive(false);
                        icon.transform.SetParent(clon.transform, false);
                        icon.gameObject.SetActive(true);
                        new BaseButton(icon.transform).onClick = (GameObject go) =>
                        {
                            setTip(item.Key, true);
                        };
                    }
                }
            }
        }
Beispiel #8
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); };
        }
Beispiel #9
0
        public void useItemByTpid(uint tpid, int num)
        {
            a3_ItemData itemDataById = this.getItemDataById(tpid);
            bool        flag         = itemDataById.use_type < 0;

            if (flag)
            {
                flytxt.instance.fly("该物品不能使用!", 0, default(Color), null);
            }
            else
            {
                int  itemNumByTpid = this.getItemNumByTpid(tpid);
                bool flag2         = itemNumByTpid < num;
                if (flag2)
                {
                    flytxt.instance.fly("物品数量不足!", 0, default(Color), null);
                }
                else
                {
                    List <a3_BagItemData> list = new List <a3_BagItemData>();
                    int num2 = 999999;
                    foreach (a3_BagItemData current in this.Items.Values)
                    {
                        bool flag3 = current.tpid == tpid;
                        if (flag3)
                        {
                            bool flag4 = current.num < num2;
                            if (flag4)
                            {
                                num2 = current.num;
                                list.Insert(0, current);
                            }
                            else
                            {
                                list.Add(current);
                            }
                        }
                    }
                    int num3 = num;
                    foreach (a3_BagItemData current2 in list)
                    {
                        bool flag5 = current2.num > num3;
                        if (flag5)
                        {
                            BaseProxy <BagProxy> .getInstance().sendUseItems(current2.id, num3);

                            break;
                        }
                        BaseProxy <BagProxy> .getInstance().sendUseItems(current2.id, current2.num);

                        num3 = num - current2.num;
                    }
                    A3_BeStronger expr_17D = A3_BeStronger.Instance;
                    if (expr_17D != null)
                    {
                        expr_17D.CheckUpItem();
                    }
                }
            }
        }
Beispiel #10
0
        public PayPanel(Transform trans) : base(trans)
        {
            this.root = trans;
            this.consumptionAwardsDic = new Dictionary <uint, awardCenterItem4Consumption>();
            this.itemsParent          = this.root.FindChild("awardItems/content");
            List <WelfareModel.itemWelfareData> cumulateConsumption = ModelBase <WelfareModel> .getInstance().getCumulateConsumption();

            foreach (WelfareModel.itemWelfareData current in cumulateConsumption)
            {
                WelfareModel.itemWelfareData iwd = current;
                iwd.desc = this.strDesc;
                a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.itemId);

                iwd.awardName = itemDataById.item_name;
                GameObject gameObject = IconImageMgr.getInstance().creatItemAwardCenterIcon(itemDataById);
                gameObject.name = "itemWelfare";
                gameObject.transform.SetParent(this.itemsParent);
                gameObject.transform.localScale = Vector3.one;
                uint id = current.itemId;
                new BaseButton(gameObject.transform.FindChild("icon"), 1, 1).onClick = delegate(GameObject oo)
                {
                    bool flag = a3_awardCenter.instan;
                    if (flag)
                    {
                        a3_awardCenter.instan.showtip(id);
                    }
                };
                awardCenterItem4Consumption value = new awardCenterItem4Consumption(gameObject.transform, iwd);
                this.consumptionAwardsDic.Add(current.id, value);
            }
            this.itemsParent.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(100 * (this.consumptionAwardsDic.Count + 2)));
            BaseProxy <welfareProxy> .getInstance().addEventListener(welfareProxy.ACCUMULATECONSUMPTION, new Action <GameEvent>(this.onAccumulateConsumption));
        }
Beispiel #11
0
        public LvlUpAwardPanel(Transform trans) : base(trans)
        {
            this.root           = trans;
            this.lvlUpAwardsDic = new Dictionary <uint, awardCenterItem4zhuan>();
            this.itemsParent    = this.root.FindChild("awardItems/content");
            List <WelfareModel.itemWelfareData> levelReward = ModelBase <WelfareModel> .getInstance().getLevelReward();

            foreach (WelfareModel.itemWelfareData current in levelReward)
            {
                WelfareModel.itemWelfareData iwd = current;
                iwd.desc = this.strDesc;
                a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(current.itemId);

                GameObject gameObject = IconImageMgr.getInstance().creatItemAwardCenterIcon(itemDataById);
                gameObject.name = "itemWelfare";
                gameObject.transform.SetParent(this.itemsParent);
                gameObject.transform.localScale = Vector3.one;
                awardCenterItem4zhuan value = new awardCenterItem4zhuan(gameObject.transform, iwd);
                uint id = current.itemId;
                new BaseButton(gameObject.transform.FindChild("icon"), 1, 1).onClick = delegate(GameObject oo)
                {
                    bool flag = a3_awardCenter.instan;
                    if (flag)
                    {
                        a3_awardCenter.instan.showtip(id);
                    }
                };
                this.lvlUpAwardsDic.Add(current.id, value);
            }
            this.itemsParent.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, (float)(100 * (this.lvlUpAwardsDic.Count + 2)));
            BaseProxy <welfareProxy> .getInstance().addEventListener(welfareProxy.UPLEVELAWARD, new Action <GameEvent>(this.onUpLevelAward));
        }
        public void AutoBuy()
        {
            uint        num      = 99;
            uint        itm_tpid = GetFeedItemTpid();
            a3_BagModel bag      = a3_BagModel.getInstance();
            a3_ItemData itmdata  = bag.getItemDataById(itm_tpid);
            long        money    = num * itmdata.on_sale;

            if (PlayerModel.getInstance().money < money)
            {
                int i = (int)PlayerModel.getInstance().money / itmdata.on_sale;
                if (i > 0)
                {
                    Shop_a3Proxy.getInstance().BuyStoreItems(itm_tpid, (uint)i);
                    flytxt.instance.fly(ContMgr.getCont("petmodel_addfood", new List <string> {
                        i.ToString(), itmdata.item_name.ToString()
                    }));
                    // flytxt.instance.fly("成功补充了" + i + "个" + itmdata.item_name);
                }
                else if (i <= 0)
                {
                    flytxt.instance.fly(ContMgr.getCont("petmodel_nofood"));
                    //flytxt.instance.fly("金币不足,补充宠物饲料失败");
                }
            }
            else
            {
                Shop_a3Proxy.getInstance().BuyStoreItems(itm_tpid, num);
                flytxt.instance.fly(ContMgr.getCont("petmodel_addfood", new List <string> {
                    num.ToString(), itmdata.item_name.ToString()
                }));
                //flytxt.instance.fly("成功补充了" + num + "个" + itmdata.item_name);
            }
        }
Beispiel #13
0
        public override void onShowed()
        {
            a3_BagModel bag = a3_BagModel.getInstance();

            itmdata = bag.getItemDataById(itm_tpid);

            Image icon = getComponentByPath <Image>("iconimage/icon");

            icon.sprite = GAMEAPI.ABUI_LoadSprite(itmdata.file);

            Image iconborder = getComponentByPath <Image>("iconimage/iconborder");

            iconborder.sprite = GAMEAPI.ABUI_LoadSprite(itmdata.borderfile);

            getComponentByPath <Text>("nimg/name").text = itmdata.item_name;
            getComponentByPath <Text>("desc").text      = itmdata.desc;

            slider.minValue = min_num;
            slider.maxValue = max_num;

            uint num = (uint)slider.value;

            getComponentByPath <Text>("num").text = num.ToString();

            long money = num * itmdata.on_sale;

            getComponentByPath <Text>("money").text = money.ToString();
        }
Beispiel #14
0
        void addtoget(a3_ItemData item)
        {
            ArrayList data1 = new ArrayList();

            data1.Add(item);
            data1.Add(InterfaceMgr.A3_WIBG_SKIN);
            InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_ITEMLACK, data1);
        }
Beispiel #15
0
        private void addtoget(a3_ItemData item)
        {
            ArrayList arrayList = new ArrayList();

            arrayList.Add(item);
            arrayList.Add(InterfaceMgr.A3_WIBG_SKIN);
            InterfaceMgr.getInstance().open(InterfaceMgr.A3_ITEMLACK, arrayList, false);
        }
Beispiel #16
0
        public GameObject createItemIcon4Lottery(a3_ItemData item, bool istouch = false, int num = -1, bool isicon = false, float scale = 1.0f, bool tip = false)
        {
            GameObject iconPrefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_iconimage");
            GameObject root       = GameObject.Instantiate(iconPrefab) as GameObject;
            Image      borderIcon = root.GetComponent <Image>();

            borderIcon.enabled = false;
            Image icon = root.transform.FindChild("icon").GetComponent <Image>();

            icon.sprite = GAMEAPI.ABUI_LoadSprite(item.file);

            Image Qicon = root.transform.FindChild("qicon").GetComponent <Image>();

            Qicon.sprite = GAMEAPI.ABUI_LoadSprite(item.borderfile);
            Qicon.gameObject.SetActive(true);

            if (isicon)
            {
                Image Bicon = root.transform.FindChild("bicon").GetComponent <Image>();
                Bicon.gameObject.SetActive(true);
            }

            Transform iconborder = root.transform.FindChild("iconbor");

            iconborder.gameObject.SetActive(false);
            Text numText = root.transform.FindChild("num").GetComponent <Text>();

            numText.enabled = false;
            if (istouch)
            {
                root.transform.GetComponent <Button>().enabled = true;
            }
            else
            {
                root.transform.GetComponent <Button>().enabled = false;
            }
            if (num != -1)
            {
                numText.text = num.ToString();
                numText.gameObject.SetActive(true);
            }
            else
            {
                numText.gameObject.SetActive(false);
            }


            //if (tip)
            //{
            //    EventTriggerListener.Get(root).onDown = (GameObject go) => { TipMgr._instacne.show(item, go.GetComponent<RectTransform>().position); };
            //    EventTriggerListener.Get(root).onExit = (GameObject go) => { TipMgr._instacne.hide(); };
            //    EventTriggerListener.Get(root).onUp = (GameObject go) => { TipMgr._instacne.hide(); };
            //}

            root.name = "icon";
            root.transform.localScale = new Vector3(scale, scale, 1.0f);
            return(root);
        }
Beispiel #17
0
        public bool checkisSelfEquip(a3_ItemData data)
        {
            bool result = false;
            bool flag   = ModelBase <PlayerModel> .getInstance().profession == data.job_limit || data.job_limit == 1;

            if (flag)
            {
                result = true;
            }
            return(result);
        }
Beispiel #18
0
        public GameObject createLotteryInfo(itemLotteryAwardInfoData data, bool isTouch = false, int num = -1, float scale = 1f)
        {
            GameObject  original     = Resources.Load("prefab/lotteryItemAwardInfo") as GameObject;
            GameObject  gameObject   = UnityEngine.Object.Instantiate <GameObject>(original);
            Text        component    = gameObject.transform.FindChild("txt_info").GetComponent <Text>();
            a3_ItemData itemDataById = ModelBase <a3_BagModel> .getInstance().getItemDataById(data.tpid);

            component.text = string.Format("<color=#ff0000>{0}</color> <color=#ffffff>获得了</color> {1}", data.name, a3_lottery.mInstance.GetLotteryItemNameColor(itemDataById.item_name, itemDataById.quality));
            gameObject.transform.localScale = new Vector3(scale, scale, 1f);
            return(gameObject);
        }
Beispiel #19
0
        public GameObject creatItemAwardCenterIcon(a3_ItemData item)
        {
            GameObject original   = Resources.Load("prefab/itemAwardCenter") as GameObject;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original);
            Image      component  = gameObject.transform.FindChild("icon").GetComponent <Image>();

            component.sprite = (Resources.Load(item.file, typeof(Sprite)) as Sprite);
            Text component2 = gameObject.transform.FindChild("txtInfor").GetComponent <Text>();

            gameObject.name = "icon";
            return(gameObject);
        }
        void SetNeedItem()
        {
            if (!A3_SummonModel.getInstance().GetSummons().ContainsKey(CurSummonID))
            {
                return;
            }
            a3_BagItemData data   = A3_SummonModel.getInstance().GetSummons()[CurSummonID];
            List <SXML>    reset  = sumXml.GetNodeList("reset");
            int            itemid = 0;
            int            num    = 0;

            foreach (SXML it in reset)
            {
                if (data.summondata.star == it.getInt("star"))
                {
                    itemid     = it.getInt("need_item_id");
                    NeedItemId = itemid;
                    num        = it.getInt("need_item_sum");
                    break;
                }
            }
            if (itemid > 0 && num != 0)
            {
                for (int i = 0; i < tranObj.transform.FindChild("needitem/icon").childCount; i++)
                {
                    GameObject.Destroy(tranObj.transform.FindChild("needitem/icon").GetChild(i).gameObject);
                }
                a3_ItemData itemdata = a3_BagModel.getInstance().getItemDataById((uint)itemid);
                GameObject  icon     = IconImageMgr.getInstance().createA3ItemIcon(itemdata);
                icon.transform.SetParent(tranObj.transform.FindChild("needitem/icon"), false);
                new BaseButton(icon.transform).onClick = (GameObject go) =>
                {
                    ArrayList arr = new ArrayList();
                    arr.Add((uint)itemid);
                    arr.Add(1);
                    InterfaceMgr.getInstance().ui_async_open(InterfaceMgr.A3_MINITIP, arr);
                };
                int haveCount = a3_BagModel.getInstance().getItemNumByTpid((uint)itemid);
                if (num <= haveCount)
                {
                    tranObj.transform.FindChild("needitem/count").GetComponent <Text>().text = "<color=#00FF56FF>" + haveCount + "/" + num + "</color>";
                    //tranObj.transform.FindChild("todo").GetComponent<Button>().interactable = true;
                    CanDo_change = true;
                }
                else
                {
                    tranObj.transform.FindChild("needitem/count").GetComponent <Text>().text = "<color=#f90e0e>" + haveCount + "/" + num + "</color>";
                    //tranObj.transform.FindChild("todo").GetComponent<Button>().interactable = false;
                    CanDo_change = false;
                }
            }
        }
        public Dictionary <a3_ItemData, uint> getFirstChargeDataList()//首充奖励
        {
            itemDataList.Clear();

            Dictionary <uint, uint> itemIds = getFirstChargeXml();

            foreach (KeyValuePair <uint, uint> item in itemIds)
            {
                uint        id   = item.Key;
                a3_ItemData data = a3_BagModel.getInstance().getItemDataById(id);
                itemDataList.Add(data, item.Value);
            }
            return(itemDataList);
        }
Beispiel #22
0
        public GameObject createA3EquipIcon(a3_ItemData data, int stage = -1, int blessing_lv = 0, float scale = 1.0f, bool istouch = false)
        {
            string     file       = "icon_equip_" + data.tpid;
            string     borderfile = "icon_itemborder_b039_0" + data.quality;
            GameObject iconPrefab = GAMEAPI.ABLayer_LoadNow_GameObject("uilayer_iconimage");
            GameObject root       = GameObject.Instantiate(iconPrefab) as GameObject;
            Image      icon       = root.transform.FindChild("icon").GetComponent <Image>();

            icon.sprite = GAMEAPI.ABUI_LoadSprite(file);
            Image     iconborder = root.transform.FindChild("iconbor").GetComponent <Image>();
            Transform war        = root.transform.FindChild("wk");

            iconborder.sprite = GAMEAPI.ABUI_LoadSprite(borderfile);

            Text numText = root.transform.FindChild("num").GetComponent <Text>();

            numText.gameObject.SetActive(false);
            root.transform.GetComponent <Button>().enabled = false;

            root.transform.localScale = new Vector3(scale, scale, 1.0f);
            root.name = "icon";

            if (istouch)
            {
                root.transform.GetComponent <Button>().enabled = true;
            }
            else
            {
                root.transform.GetComponent <Button>().enabled = false;
            }

            if (!a3_EquipModel.getInstance().checkisSelfEquip(data))
            {
                root.transform.FindChild("iconborder/equip_self").gameObject.SetActive(true);
            }
            else
            {
                if (!a3_EquipModel.getInstance().checkCanEquip(data, stage, blessing_lv))
                {
                    root.transform.FindChild("iconborder/equip_canequip").gameObject.SetActive(true);
                }
            }

            icon.transform.GetComponent <RectTransform>().sizeDelta       = new Vector2(80, 160);
            iconborder.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(80, 160);
            war.GetComponent <RectTransform>().sizeDelta            = new Vector2(80, 160);
            root.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(92, 166);

            return(root);
        }
Beispiel #23
0
        public GameObject createItemIcon4Lottery(a3_ItemData item, bool istouch = false, int num = -1, bool isicon = false, float scale = 1f, bool tip = false)
        {
            GameObject original   = Resources.Load("prefab/iconimage") as GameObject;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original);
            Image      component  = gameObject.GetComponent <Image>();

            component.enabled = false;
            Image component2 = gameObject.transform.FindChild("icon").GetComponent <Image>();

            component2.sprite = (Resources.Load(item.file, typeof(Sprite)) as Sprite);
            Image component3 = gameObject.transform.FindChild("qicon").GetComponent <Image>();

            component3.sprite = (Resources.Load(item.borderfile, typeof(Sprite)) as Sprite);
            component3.gameObject.SetActive(true);
            if (isicon)
            {
                Image component4 = gameObject.transform.FindChild("bicon").GetComponent <Image>();
                component4.gameObject.SetActive(true);
            }
            Transform transform = gameObject.transform.FindChild("iconbor");

            transform.gameObject.SetActive(false);
            Text component5 = gameObject.transform.FindChild("num").GetComponent <Text>();

            component5.enabled = false;
            if (istouch)
            {
                gameObject.transform.GetComponent <Button>().enabled = true;
            }
            else
            {
                gameObject.transform.GetComponent <Button>().enabled = false;
            }
            bool flag = num != -1;

            if (flag)
            {
                component5.text = num.ToString();
                component5.gameObject.SetActive(true);
            }
            else
            {
                component5.gameObject.SetActive(false);
            }
            gameObject.name = "icon";
            gameObject.transform.localScale = new Vector3(scale, scale, 1f);
            return(gameObject);
        }
Beispiel #24
0
        public GameObject createA3EquipIcon(a3_ItemData data, int stage = -1, int blessing_lv = 0, float scale = 1f, bool istouch = false)
        {
            string     path       = "icon/equip/" + data.tpid;
            string     path2      = "icon/itemborder/b039_0" + data.quality;
            GameObject original   = Resources.Load("prefab/iconimage") as GameObject;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(original);
            Image      component  = gameObject.transform.FindChild("icon").GetComponent <Image>();

            component.sprite = (Resources.Load(path, typeof(Sprite)) as Sprite);
            Image     component2 = gameObject.transform.FindChild("iconbor").GetComponent <Image>();
            Transform transform  = gameObject.transform.FindChild("wk");

            component2.sprite = (Resources.Load(path2, typeof(Sprite)) as Sprite);
            Text component3 = gameObject.transform.FindChild("num").GetComponent <Text>();

            component3.gameObject.SetActive(false);
            gameObject.transform.GetComponent <Button>().enabled = false;
            gameObject.transform.localScale = new Vector3(scale, scale, 1f);
            gameObject.name = "icon";
            if (istouch)
            {
                gameObject.transform.GetComponent <Button>().enabled = true;
            }
            else
            {
                gameObject.transform.GetComponent <Button>().enabled = false;
            }
            bool flag = !ModelBase <a3_EquipModel> .getInstance().checkisSelfEquip(data);

            if (flag)
            {
                gameObject.transform.FindChild("iconborder/equip_self").gameObject.SetActive(true);
            }
            else
            {
                bool flag2 = !ModelBase <a3_EquipModel> .getInstance().checkCanEquip(data, stage, blessing_lv);

                if (flag2)
                {
                    gameObject.transform.FindChild("iconborder/equip_canequip").gameObject.SetActive(true);
                }
            }
            component.transform.GetComponent <RectTransform>().sizeDelta  = new Vector2(80f, 160f);
            component2.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(80f, 160f);
            transform.GetComponent <RectTransform>().sizeDelta            = new Vector2(80f, 160f);
            gameObject.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(92f, 166f);
            return(gameObject);
        }
        private void setTip(a3_ItemData item, bool Eqp = false)
        {
            base.transform.FindChild("tip").gameObject.SetActive(true);
            base.transform.FindChild("tip/text_bg/name/namebg").GetComponent <Text>().text  = item.item_name;
            base.transform.FindChild("tip/text_bg/name/namebg").GetComponent <Text>().color = Globle.getColorByQuality(item.quality);
            if (Eqp)
            {
                base.transform.FindChild("tip/text_bg/name/lite").GetComponent <Text>().text = "使用职业:";
                switch (item.job_limit)
                {
                case 1:
                    base.transform.FindChild("tip/text_bg/name/dengji").GetComponent <Text>().text = "无限制";
                    break;

                case 2:
                    base.transform.FindChild("tip/text_bg/name/dengji").GetComponent <Text>().text = "狂战士";
                    break;

                case 3:
                    base.transform.FindChild("tip/text_bg/name/dengji").GetComponent <Text>().text = "法师";
                    break;

                case 5:
                    base.transform.FindChild("tip/text_bg/name/dengji").GetComponent <Text>().text = "暗影";
                    break;
                }
            }
            else
            {
                base.transform.FindChild("tip/text_bg/name/lite").GetComponent <Text>().text = "使用等级:";
                bool flag = item.use_limit <= 0;
                if (flag)
                {
                    base.transform.FindChild("tip/text_bg/name/dengji").GetComponent <Text>().text = "无限制";
                }
                else
                {
                    base.transform.FindChild("tip/text_bg/name/dengji").GetComponent <Text>().text = item.use_limit + "转";
                }
            }
            base.transform.FindChild("tip/text_bg/text").GetComponent <Text>().text           = StringUtils.formatText(item.desc);
            base.transform.FindChild("tip/text_bg/iconbg/icon").GetComponent <Image>().sprite = (Resources.Load(item.file, typeof(Sprite)) as Sprite);
            new BaseButton(base.transform.FindChild("tip/close_btn"), 1, 1).onClick           = delegate(GameObject oo)
            {
                base.transform.FindChild("tip").gameObject.SetActive(false);
            };
        }
Beispiel #26
0
        void setAwd(Transform con, GameObject item, List <SXML> rew, List <SXML> awds_coin)
        {
            foreach (SXML one in rew)
            {
                GameObject clon = Instantiate(item) as GameObject;
                clon.SetActive(true);
                clon.transform.SetParent(con, false);
                uint       id   = (uint)one.getInt("item_id");
                int        num  = one.getInt("value");
                GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(id, scale: 0.8f);
                icon.transform.SetParent(clon.transform.FindChild("pic/icon"), false);
                clon.transform.FindChild("pic/num").GetComponent <Text>().text = num.ToString();
            }

            foreach (SXML x in awds_coin)
            {
                GameObject clon = Instantiate(item) as GameObject;
                clon.SetActive(true);
                clon.transform.SetParent(con, false);
                a3_ItemData itemdata = new a3_ItemData();
                itemdata.borderfile = "icon_itemborder_b039_05";
                if (x.getInt("type") == 2)
                {
                    itemdata.file = "icon_comm_0x2";
                }
                else if (x.getInt("type") == 3)
                {
                    itemdata.file = "icon_coin_coin2";
                }
                else if (x.getInt("type") == 4)
                {
                    itemdata.file = "icon_coin_coin3";
                }
                else if (x.getInt("type") == 5)
                {
                    itemdata.file = "icon_coin_coin4";
                }
                else
                {
                    itemdata.file = "icon_comm_0x2";
                }
                GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(itemdata, false, -1, 0.8f);
                int        num  = x.getInt("value");
                icon.transform.SetParent(clon.transform.FindChild("pic/icon"), false);
                clon.transform.FindChild("pic/num").GetComponent <Text>().text = num.ToString();
            }
        }
Beispiel #27
0
        public a3_ItemData getItemDataById(uint tpid)
        {
            a3_ItemData result = default(a3_ItemData);

            result.tpid = tpid;
            SXML node = this.itemsXMl.GetNode("item", "id==" + tpid);
            bool flag = node != null;

            if (flag)
            {
                result.file       = "icon/item/" + node.getString("icon_file");
                result.borderfile = "icon/itemborder/b039_0" + node.getString("quality");
                result.item_name  = node.getString("item_name");
                result.quality    = node.getInt("quality");
                result.desc       = node.getString("desc");
                result.desc2      = node.getString("desc2");
                result.maxnum     = node.getInt("maxnum");
                result.value      = node.getInt("value");
                result.use_lv     = node.getInt("use_lv");
                result.use_limit  = node.getInt("use_limit");
                result.use_type   = node.getInt("use_type");
                int @int = node.getInt("intensify_score");
                result.intensify_score = @int;
                result.item_type       = node.getInt("item_type");
                bool flag2 = node.getInt("sort_type") < 0;
                if (flag2)
                {
                    result.sortType = 9999;
                }
                else
                {
                    result.sortType = node.getInt("sort_type");
                }
                result.equip_type      = node.getInt("equip_type");
                result.equip_level     = node.getInt("equip_level");
                result.job_limit       = node.getInt("job_limit");
                result.modelId         = node.getInt("model_id");
                result.on_sale         = node.getInt("on_sale");
                result.cd_type         = node.getInt("cd_type");
                result.cd_time         = node.getFloat("cd");
                result.main_effect     = node.getInt("main_effect");
                result.add_basiclevel  = node.getInt("add_basiclevel");
                result.use_sum_require = node.getInt("use_sum_require");
            }
            return(result);
        }
Beispiel #28
0
        /// <summary>
        /// 获取背包里面有的,并按照配置顺序的MP药的ID,没有返回-1
        /// </summary>
        /// <returns></returns>
        private int GetNormalMpID()
        {
            var etor = mpOrder.GetEnumerator();

            while (etor.MoveNext())
            {
                bool        hasItem = a3_BagModel.getInstance().hasItem((uint)etor.Current);
                a3_ItemData item    = a3_BagModel.getInstance().getItemDataById((uint)etor.Current);
                bool        canUse  = item.use_limit < PlayerModel.getInstance().up_lvl ||
                                      item.use_limit == PlayerModel.getInstance().up_lvl&& item.use_lv <= PlayerModel.getInstance().lvl;
                if (hasItem && canUse)
                {
                    return(etor.Current);
                }
            }
            return(-1);
        }
Beispiel #29
0
        void createAward(uint dayCount)
        {
            //for (int n=0;n< objlist.Count;n++) {
            //    objlist[n].des();
            //}
            //objlist.Clear();
            awdlist.Clear();
            List <WelfareModel.itemWelfareData> iwdList = WelfareModel.getInstance().getDailyLogin();

            for (int i = 0; i < iwdList.Count; i++)
            {
                if (i < 7)
                {
                    WelfareModel.itemWelfareData iwd = iwdList[i];
                    a3_ItemData itemData             = a3_BagModel.getInstance().getItemDataById(iwd.itemId);
                    bool        claim  = false;
                    bool        canget = false;
                    if (i < dayCount)
                    {
                        claim = true;
                    }

                    if (i == dayCount)
                    {
                        canget = true;
                    }

                    GameObject goItemAward = transform.FindChild("body/awardItems/content/itemAward" + (i + 1)).gameObject;

                    itemAwardData iad = new itemAwardData();
                    iad.parent = _content;
                    iad.trSelf = goItemAward.transform;
                    //iad.trAward = goIcon.transform;./seven_day 1
                    iad.dayNum    = (uint)i;
                    iad.dayCount  = dayCount;
                    iad.isChecked = claim;
                    iad.canGet    = canget;
                    iad.name      = itemData.item_name;
                    iad.awardnum  = iwd.num;
                    // itemAward ad = new itemAward(iad);
                    // objlist.Add(ad);
                    SetAwd(iad);
                    awdlist[i + 1] = iad;
                }
            }
        }
Beispiel #30
0
        public override void onShowed()
        {
            ToWin = false;
            transform.SetAsLastSibling();
            toget.SetActive(false);
            if (uiData == null)
            {
                return;
            }
            if (uiData.Count != 0)
            {
                item_data = (a3_ItemData)uiData[0];
                if (uiData.Count > 1)
                {
                    closewindow = (string)uiData[1];
                }
                if (uiData.Count > 2)
                {
                    avatarobj = (GameObject)uiData[2];
                }
                if (uiData.Count > 3)
                {
                    back_uidata = (ArrayList)uiData[3];
                }
            }
            Transform info  = transform.FindChild("info");
            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);

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

            if (avatarobj != null)
            {
                avatarobj.SetActive(false);
            }
        }