/** 初始化道具 */
    public void initPropButton(GameObject gameObj, Prop prop, int index)
    {
        GameObject obj = NGUITools.AddChild(gameObj, goodsViewPrefab);

        obj.transform.localScale = new Vector3(1.4f, 1.4f, 1);
        GoodsView goods = obj.GetComponent <GoodsView> ();

        goods.fatherWindow = this;
        goods.linkQualityEffectPoint();
        goods.init(prop, 0);
        goods.onClickCallback = () => {
            UiManager.Instance.openDialogWindow <PropAttrWindow>((win) => {
                win.Initialize(prop);
            });
        };
        if (cardName != null)
        {
            string color = QualityManagerment.getQualityColor(prop.getQualityId());
            cardName.text = color + prop.getName() + "[-]";
            GameObject card_name = NGUITools.AddChild(obj, cardName.gameObject);
            card_name.transform.localScale    = new Vector3(0.8f, 0.8f, 1);
            card_name.transform.localPosition = new Vector3(0, -70, 0);
            card_name.SetActive(true);
        }
    }
    /** 初始化装备 */
    public void initEquipButton(GameObject gameObj, Equip equip, int index)
    {
        GameObject obj = NGUITools.AddChild(gameObj, goodsViewPrefab);

        obj.transform.localScale = new Vector3(1.4f, 1.4f, 1);
        GoodsView goods = obj.GetComponent <GoodsView> ();

        goods.fatherWindow = this;
        goods.linkQualityEffectPoint();
        goods.init(equip, 0);
        goods.onClickCallback = () => {
            TweenAlpha lname = TweenAlpha.Begin(gameObject, 1f, 0);
            lname.from = 1;
            UiManager.Instance.openWindow <EquipAttrWindow> ((winEquip) => {
                winEquip.Initialize(equip, EquipAttrWindow.OTHER, () => {
                    lname      = TweenAlpha.Begin(gameObject, 1.5f, 1);
                    lname.from = 0;
                });
            });
        };
        if (cardName != null)
        {
            string color = QualityManagerment.getQualityColor(equip.getQualityId());
            cardName.text = color + equip.getName() + "[-]";
            GameObject card_name = NGUITools.AddChild(obj, cardName.gameObject);
            card_name.transform.localScale    = new Vector3(0.8f, 0.8f, 1);
            card_name.transform.localPosition = new Vector3(0, -70, 0);
            card_name.SetActive(true);
        }
    }
    /** 初始化秘宝 */
    public void initMagicWeaponButton(GameObject gameObj, MagicWeapon magicWeap, int index)
    {
        GameObject obj = NGUITools.AddChild(gameObj, goodsViewPrefab);

        obj.transform.localScale = new Vector3(1.4f, 1.4f, 1);
        GoodsView goods = obj.GetComponent <GoodsView>();

        goods.fatherWindow = this;
        goods.linkQualityEffectPoint();
        goods.init(magicWeap);
        goods.onClickCallback = goods.DefaultClickEvent;
        //goods.onClickCallback = () => {
        //    TweenAlpha lname = TweenAlpha.Begin(gameObject, 1f, 0);
        //    lname.from = 1;
        //    UiManager.Instance.openWindow<MagicWeaponStrengWindow>((win) => {
        //        win.Initialize(magicWeap, EquipAttrWindow.OTHER, () => {
        //            lname = TweenAlpha.Begin(gameObject, 1.5f, 1);
        //            lname.from = 0;
        //        });
        //    });
        //};
        if (cardName != null)
        {
            string color = QualityManagerment.getQualityColor(magicWeap.getMagicWeaponQuality());
            cardName.text = color + magicWeap.getName() + "[-]";
            GameObject card_name = NGUITools.AddChild(obj, cardName.gameObject);
            card_name.transform.localScale    = new Vector3(0.8f, 0.8f, 1);
            card_name.transform.localPosition = new Vector3(0, -70, 0);
            card_name.SetActive(true);
        }
    }
Example #4
0
    //0道具,1装备,2卡片 3,神器
    private GameObject CreateGoodsItem(int sid, int count, int type)
    {
        GameObject obj = NGUITools.AddChild(awardContent, goodsViewPrefab) as GameObject;

        obj.SetActive(false);
        GoodsView view = obj.transform.GetComponent <GoodsView> ();

        view.linkQualityEffectPoint();
        view.fatherWindow = this;
        if (type == 0)
        {
            Prop p = PropManagerment.Instance.createProp(sid, count);
            view.init(p);
        }
        else if (type == 1)
        {
            Equip e = EquipManagerment.Instance.createEquip(sid);
            view.init(e);
            view.onClickCallback = () => {
                hideWindow();
                UiManager.Instance.openWindow <EquipAttrWindow>(
                    (winEquip) => {
                    winEquip.Initialize(e, EquipAttrWindow.OTHER, () => {
                        EventDelegate.Add(winEquip.OnHide, () => {
                            restoreWindow();
                        });
                    });
                }
                    );
            };
        }
        else if (type == 2)
        {
            Card c = CardManagerment.Instance.createCard(sid);
            view.init(c);
            view.onClickCallback = () => {
                hideWindow();
                CardBookWindow.Show(c, CardBookWindow.SHOW, () => {
                    EventDelegate.Add(UiManager.Instance.getWindow <CardBookWindow>().OnHide, () => {
                        restoreWindow();
                    });
                });
            };
        }
        else if (type == 3)
        {
            MagicWeapon mc = MagicWeaponManagerment.Instance.createMagicWeapon(sid);
            view.init(mc);
            view.onClickCallback = () => {
                hideWindow();
                UiManager.Instance.openWindow <MagicWeaponStrengWindow>((win) => {
                    win.init(mc, MagicWeaponType.FORM_OTHER);
                });
            };
        }
        return(obj);
    }
    /// <summary>
    /// 初始化按钮的显示
    /// </summary>
    /// <param name="level">当前等级.</param>
    /// <param name="prize">对应的奖励.</param>
    public void init(int level, PrizeSample prize)
    {
        int curLevel = UserManager.Instance.self.getUserLevel();

        if (curLevel >= level)
        {
            goodsButton.openEffectsShow();
            goodsButton.linkQualityEffectPoint();
            goodsButton.showEffectByQuality(prize.getQuality());
        }
        lab_info.text = level.ToString();
        goodsButton.clear();
        switch (prize.type)
        {
        case PrizeType.PRIZE_BEAST:
            Card beast = CardManagerment.Instance.createCard(prize.pSid);
            goodsButton.init(beast);
            break;

        case PrizeType.PRIZE_CARD:
            Card card = CardManagerment.Instance.createCard(prize.pSid);
            goodsButton.init(card);
            break;

        case PrizeType.PRIZE_EQUIPMENT:
            Equip equip = EquipManagerment.Instance.createEquip(prize.pSid);
            goodsButton.init(equip);
            break;

        case PrizeType.PRIZE_MONEY:
            PrizeSample prizeMoney = new PrizeSample(PrizeType.PRIZE_MONEY, 0, prize.num);
            goodsButton.init(prizeMoney);
            break;

        case PrizeType.PRIZE_PROP:
            Prop prop = PropManagerment.Instance.createProp(prize.pSid);
            goodsButton.init(prop, prize.getPrizeNumByInt());
            break;

        case PrizeType.PRIZE_RMB:
            PrizeSample prizeRmb = new PrizeSample(PrizeType.PRIZE_RMB, 0, prize.num);
            goodsButton.init(prizeRmb);
            break;
        }
        if (curLevel < level)
        {
            goodsButton.closeEffectsShow();
        }
    }
Example #6
0
    //0道具,1装备,2卡片.3神器
    private GameObject CreateGoodsItem(int sid, int count, int type)
    {
        GameObject obj = Instantiate(goodsViewPrefab) as GameObject;

        obj.transform.localScale = new Vector3(0.7f, 0.7f, 1);
        GoodsView view = obj.transform.GetComponent <GoodsView> ();

        view.linkQualityEffectPoint();
        view.fatherWindow = this;
        if (type == 0)
        {
            Prop p = PropManagerment.Instance.createProp(sid, count);
            view.init(p);
        }
        else if (type == 1)
        {
            Equip e = EquipManagerment.Instance.createEquip(sid);
            view.init(e);
            view.onClickCallback = () => {
                UiManager.Instance.openWindow <EquipAttrWindow> ((winEquip) => {
                    winEquip.Initialize(e, EquipAttrWindow.OTHER, null);
                });
            };
        }
        else if (type == 2)
        {
            Card c = CardManagerment.Instance.createCard(sid);
            view.init(c);
            view.onClickCallback = () => {
                CardBookWindow.Show(c, CardBookWindow.SHOW, null);
            };
        }
        else if (type == 3)
        {
            MagicWeapon mc = MagicWeaponManagerment.Instance.createMagicWeapon(sid);
            view.init(mc);
            view.onClickCallback = () => {
                hideWindow();
                UiManager.Instance.openWindow <MagicWeaponStrengWindow>((win) => {
                    win.init(mc, MagicWeaponType.FORM_OTHER);
                });
            };
        }
        return(obj);
    }
Example #7
0
 /** 创建奖励对象 */
 private void CreateGoodsByAward(List <GameObject> awards, Award aw)
 {
     if (aw != null)
     {
         List <PrizeSample> awardListt = AllAwardViewManagerment.Instance.exchangeAwardToPrize(aw);
         if (awardListt != null && awardListt.Count > 0)
         {
             int nameIndex = 0;
             for (int i = 0; i < awardListt.Count; i++)
             {
                 nameIndex++;
                 GameObject obj = NGUITools.AddChild(awardContent, goodsViewPrefab) as GameObject;
                 obj.SetActive(false);
                 GoodsView view = obj.transform.GetComponent <GoodsView> ();
                 view.linkQualityEffectPoint();
                 view.fatherWindow = this;
                 view.init(awardListt[i]);
                 obj.name = "goodsbutton_" + nameIndex;
                 awardList.Add(obj);
             }
         }
     }
 }