예제 #1
0
    protected override bool init()
    {
        name    = UT.getComponent <Text>(rootObject(), "txtName");
        level   = UT.getComponent <Text>(rootObject(), "txtLevel");
        exp     = UT.getComponent <Text>(rootObject(), "txtExp");
        gold    = UT.getComponent <Text>(rootObject(), "txtGold");
        diamond = UT.getComponent <Text>(rootObject(), "txtDiamond");
        updateShow();

        Button btnFunc = UT.getComponent <Button>(rootObject(), "funcs/Viewport/Content/chapter");

        btnFunc.onClick.AddListener(() => {
            this.switchSubView(new LayerChapter());
        });
        btnFunc = UT.getComponent <Button>(rootObject(), "funcs/Viewport/Content/hero");
        btnFunc.onClick.AddListener(() => {
            this.switchSubView(new LayerHero());
        });
        btnFunc = UT.getComponent <Button>(rootObject(), "funcs/Viewport/Content/equip");
        btnFunc.onClick.AddListener(() => {
            this.switchSubView(new LayerEquip());
        });
        btnFunc = UT.getComponent <Button>(rootObject(), "funcs/Viewport/Content/shop");
        btnFunc.onClick.AddListener(() => {
            this.switchSubView(new LayerShop());
        });
        this.switchSubView(new LayerChapter());
        return(true);
    }
예제 #2
0
    public void updateShow()
    {
        var heros = Player.playerData.heroPack.heros;
        int idx   = 0;

        foreach (proto.Hero hero in heros.Values)
        {
            GameObject objHero;
            if (idx < allItems.Count)
            {
                objHero = allItems[idx];
            }
            else
            {
                objHero = UT.createPrefeb(item);
                allItems.Add(objHero);
                objHero.transform.SetParent(content.transform);
                objHero.transform.localScale = Vector3.one;
            }
            idx++;

            objHero.SetActive(true);
            Hero cfgHero = TableMgr.ins.tableHero[hero.id];
            UT.getComponent <Text>(objHero, "des").text = string.Format("{0}\nlev:{1}\nnum:{2}", cfgHero.Name, hero.level, hero.num);
        }
        for (int i = idx; i < allItems.Count; i++)
        {
            allItems[i].SetActive(false);
        }
    }
예제 #3
0
    protected override bool init()
    {
        account      = UT.getComponent <InputField>(rootObject(), "account");
        account.text = SaveData.data.account;

        Button btnLogin = UT.getComponent <Button>(rootObject(), "BtnLogin");

        btnLogin.onClick.AddListener(this.OnBtnClickLogin);

        return(true);
    }
예제 #4
0
파일: Layer.cs 프로젝트: weizai118/gdemo
    public void setText(string child, string text)
    {
        Text objText = null;

        if (!mCacheText.TryGetValue(child, out objText))
        {
            objText = UT.getComponent <Text>(rootObject(), child);
            mCacheText.Add(child, objText);
        }

        objText.text = text;
    }
예제 #5
0
파일: Layer.cs 프로젝트: weizai118/gdemo
    public void setText(string child, string text, string color)
    {
        Text objText = null;

        if (!mCacheText.TryGetValue(child, out objText))
        {
            objText = UT.getComponent <Text>(rootObject(), child);
            mCacheText.Add(child, objText);
        }

        objText.text = string.Format("<color=#{0}>{1}</color>", color, text);
    }
예제 #6
0
    protected override bool init()
    {
        level = UT.getComponent <Text>(rootObject(), "txtLevel");
        prize = UT.getComponent <Text>(rootObject(), "txtPrize");
        updateShow();

        Button btn = UT.getComponent <Button>(rootObject(), "btnGetPrize");

        btn.onClick.AddListener(() =>
        {
            moduleChapter.requestGetPrize();
        });
        btn = UT.getComponent <Button>(rootObject(), "btnNext");
        btn.onClick.AddListener(() =>
        {
            moduleChapter.requestChallenge();
        });
        return(true);
    }
예제 #7
0
    protected override bool init()
    {
        Text txt = UT.getComponent <Text>(rootObject(), "btnGetDiamond1/Text");

        txt.text = "钻石x" + TableMgr.ins.tableCommon[1].Val;
        txt      = UT.getComponent <Text>(rootObject(), "btnGetDiamond2/Text");
        txt.text = "钻石x" + TableMgr.ins.tableCommon[2].Val;
        txt      = UT.getComponent <Text>(rootObject(), "btnGetDiamond3/Text");
        txt.text = "钻石x" + TableMgr.ins.tableCommon[3].Val;
        txt      = UT.getComponent <Text>(rootObject(), "btnGetDiamond4/Text");
        txt.text = "钻石x" + TableMgr.ins.tableCommon[4].Val;
        txt      = UT.getComponent <Text>(rootObject(), "btnGetGold/Text");
        txt.text = "金币x" + (TableMgr.ins.tableCommon[5].Val * TableMgr.ins.tableCommon[6].Val);

        Button btn = UT.getComponent <Button>(rootObject(), "btnGetDiamond1");

        btn.onClick.AddListener(() =>
        {
            moduleShop.requestBuyDiamond(0);
        });
        btn = UT.getComponent <Button>(rootObject(), "btnGetDiamond2");
        btn.onClick.AddListener(() =>
        {
            moduleShop.requestBuyDiamond(1);
        });
        btn = UT.getComponent <Button>(rootObject(), "btnGetDiamond3");
        btn.onClick.AddListener(() =>
        {
            moduleShop.requestBuyDiamond(2);
        });
        btn = UT.getComponent <Button>(rootObject(), "btnGetDiamond4");
        btn.onClick.AddListener(() =>
        {
            moduleShop.requestBuyDiamond(3);
        });
        btn = UT.getComponent <Button>(rootObject(), "btnGetGold");
        btn.onClick.AddListener(() =>
        {
            moduleShop.requestBuyGold();
        });
        return(true);
    }
예제 #8
0
    protected override bool init()
    {
        content = UT.getChild(rootObject(), "ScrollView/Viewport/Content");
        item    = UT.getChild(rootObject(), "ScrollView/Viewport/Content/item");
        item.SetActive(false);
        allItems.Add(item);

        Button btn = UT.getComponent <Button>(rootObject(), "btnGetHero");

        btn.onClick.AddListener(() =>
        {
            modulePackHero.requestDraw(1);
        });
        btn = UT.getComponent <Button>(rootObject(), "btnGetHero10");
        btn.onClick.AddListener(() =>
        {
            modulePackHero.requestDraw(10);
        });
        updateShow();
        return(true);
    }
예제 #9
0
파일: Layer.cs 프로젝트: weizai118/gdemo
    public void setSprite(string child, Sprite spr)
    {
        Image img = UT.getComponent <Image>(rootObject(), child);

        img.sprite = spr;
    }