Example #1
0
    void RenderListItem(int index, GObject obj)
    {
        GButton item = (GButton)obj;
        Message msg  = _messages[index];

        if (!msg.fromMe)
        {
            item.GetChild("name").text = msg.sender;
        }
        item.icon = UIPackage.GetItemURL("Emoji", msg.senderIcon);

        //Recaculate the text width
        GRichTextField tf = item.GetChild("msg").asRichTextField;

        tf.emojies = _emojies;
        tf.text    = EmojiParser.inst.Parse(msg.msg);
    }
Example #2
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _messages = new List <Message>();

        _mainView = this.GetComponent <UIPanel>().ui;

        _list = _mainView.GetChild("list").asList;
        _list.SetVirtual();
        _list.itemProvider = GetListItemResource;
        _list.itemRenderer = RenderListItem;

        _input1 = _mainView.GetChild("input1").asTextInput;
        _input1.onKeyDown.Add(__inputKeyDown1);

        _input2 = _mainView.GetChild("input2").asTextInput;
        _input2.onKeyDown.Add(__inputKeyDown2);

        //作为demo,这里只添加了部分表情素材
        _emojies = new Dictionary <uint, Emoji>();
        for (uint i = 0x1f600; i < 0x1f637; i++)
        {
            string url = UIPackage.GetItemURL("Emoji", Convert.ToString(i, 16));
            if (url != null)
            {
                _emojies.Add(i, new Emoji(url));
            }
        }
        _input2.emojies = _emojies;

        _mainView.GetChild("btnSend1").onClick.Add(__clickSendBtn1);
        _mainView.GetChild("btnSend2").onClick.Add(__clickSendBtn2);

        _mainView.GetChild("btnEmoji1").onClick.Add(__clickEmojiBtn1);
        _mainView.GetChild("btnEmoji2").onClick.Add(__clickEmojiBtn2);

        _emojiSelectUI1 = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom;
        _emojiSelectUI1.fairyBatching = true;
        _emojiSelectUI1.GetChild("list").asList.onClickItem.Add(__clickEmoji1);

        _emojiSelectUI2 = UIPackage.CreateObject("Emoji", "EmojiSelectUI_ios").asCom;
        _emojiSelectUI2.fairyBatching = true;
        _emojiSelectUI2.GetChild("list").asList.onClickItem.Add(__clickEmoji2);
    }
Example #3
0
    public override void OnRefresh()
    {
        m_UI.m_FightLose.visible = false;
        m_UI.m_FightWin.visible  = false;
        HasStart          = false;
        HasClicked        = false;
        HasFinished       = false;
        m_SwordId         = Random.Range(1, 4);
        m_UI.m_Sword.icon = UIPackage.GetItemURL("SmallGame", "Sword_" + m_SwordId);

        m_UI.m_Sword.rotation          = 0;
        m_UI.m_ViewState.selectedIndex = 0;
        m_UI.m_ProgressCoundDown.max   = 3;
        m_UI.m_ProgressCoundDown.value = 3;
        m_UI.m_ProgressCoundDown.TweenValue(0, 3).OnComplete(OnCountDownFinish);

        AudioManager.inst.PlayBgAudio("SmallGame1");
    }
Example #4
0
    public MainUI()
    {
        AddUISource(new UIAsset("MainUI"));
        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("Common", "ObjItem"), typeof(SlotItem));

        for (int i = 0; i < 10; i++)
        {
            slotList[i] = new Slot();
        }

        Globals.entityManager.CreateToSlot("coal", 10, slotList[0]);
        Globals.entityManager.CreateToSlot("copper-ore", 10, slotList[1]);
        Globals.entityManager.CreateToSlot("burner-inserter", 100, slotList[2]);
        Globals.entityManager.CreateToSlot("stone-furnace", 100, slotList[3]);
        Globals.entityManager.CreateToSlot("transport-belt", 100, slotList[4]);
        Globals.entityManager.CreateToSlot("burner-mining-drill", 10, slotList[5]);
        Globals.entityManager.CreateToSlot("assembling-machine-1", 10, slotList[6]);
    }
Example #5
0
        /// <summary>
        /// 响应卡牌书内卡牌点击事件
        /// </summary>
        /// <param name="context"></param>
        public void OnClickCardInCardCollection(EventContext context)
        {
            // 先获取到点击的下标
            int index = cardcollectionlist.GetChildIndex(context.data as GObject);

            // 通过下标获取到id
            string cardId = playercardlist[index];
            // 向数据库查询展示数据
            JsonData data = CardManager.Instance().GetCardJsonData(cardId);

            _abstractText.text = "姓名:" + data["name"] + "\n" + "类型:" + data["type"];

            _storyText.text = "这里本来该有卡牌故事但是现在没有数据\n" + data["effect"];

            // TODO: 根据策划案加载icon

            _picLoader.url = UIPackage.GetItemURL(cardicons, cardId);
        }
Example #6
0
        /// <summary>展示卡牌收藏
        ///
        /// </summary>
        public void ShowCardCollect()
        {
            cardcollect_UI.Show();
            Debug.Log("展示卡牌收藏");
            //TODO:隐藏地格渲染
            mapcamera.SetActive(false);
            cardcollectionlist.RemoveChildren(0, -1, true);

            foreach (string cardId in playercardlist)
            {
                GObject item = UIPackage.CreateObject("CardCollection", "cardsSetsItem");
                item.icon = UIPackage.GetItemURL(cardicons, cardId);
                cardcollectionlist.AddChild(item);
            }
            GButton closebtn = cardcollect_UI.contentPane.GetChild("Close").asButton;

            closebtn.onClick.Add(() => CloseCardCollect());
        }
Example #7
0
    void Start()
    {
        Application.targetFrameRate = 60;

        Stage.inst.onKeyDown.Add(OnKeyDown);

        Transform npc   = GameObject.Find("npc1").transform;
        UIPanel   panel = npc.FindChild("HeadBar").GetComponent <UIPanel>();

        panel.ui.GetChild("name").text = "Long [color=#FFFFFF]Long[/color][img]" + UIPackage.GetItemURL("HeadBar", "cool") + "[/img] Name";
        panel.ui.GetChild("blood").asProgress.value = 75;
        panel.ui.GetChild("sign").asLoader.url      = UIPackage.GetItemURL("HeadBar", "task");

        npc   = GameObject.Find("npc2").transform;
        panel = npc.FindChild("HeadBar").GetComponent <UIPanel>();
        panel.ui.GetChild("name").text = "Man2";
        panel.ui.GetChild("blood").asProgress.value = 25;
        panel.ui.GetChild("sign").asLoader.url      = UIPackage.GetItemURL("HeadBar", "fighting");
    }
Example #8
0
    protected override void refresh()
    {
        title.text   = entity.config.showName;
        archIcon.url = UIPackage.GetItemURL("Icon", entity.id);

        factory = entityBase as Factory;

        targetList.numItems = factory.inSlots.Length;
        outSlot.setSlot(factory.outSlot);

        if (factory.blueprint)
        {
            contentPane.GetController("c1").SetSelectedIndex(1);
        }
        else
        {
            contentPane.GetController("c1").SetSelectedIndex(0);
        }
    }
Example #9
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Extension");
        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("Extension", "mailItem"), typeof(MailItem));

        _mainView = UIPackage.CreateObject("Extension", "Main").asCom;
        _mainView.fairyBatching = true;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _list = _mainView.GetChild("mailList").asList;
        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.AddItemFromPool();
            item.setFetched(i % 3 == 0);
            item.setRead(i % 2 == 0);
            item.setTime("5 Nov 2015 16:24:33");
            item.title = "Mail title here";
        }

        _list.EnsureBoundsCorrect();
        float delay = 0f;

        for (int i = 0; i < 10; i++)
        {
            MailItem item = (MailItem)_list.GetChildAt(i);
            if (_list.IsChildInView(item))
            {
                item.PlayEffect(delay);
                delay += 0.2f;
            }
            else
            {
                break;
            }
        }
    }
Example #10
0
    private void RenderListItem(int index, GObject obj)
    {
        GButton btn = obj.asButton;

        btn.title = "";
        btn.icon  = "";
        if (index >= box.goodsList.Count)
        {
            return;
        }
        Goods goods = box.goodsList[index];

        btn.title = goods.type;
        // 判断icon是否为具体路径
        string url = goods.icon;

        if (!url.StartsWith("ui"))
        {
            url = UIPackage.GetItemURL("BattleCity8102", "goods-" + goods.icon);
        }
        btn.icon = url;
        // 背景#EFC324表示重要物资,#FFFFFF为普通物资
        //btn.GetChild("rightBg").asGraph.color = new Color();
        //btn.GetChild("leftBg").asGraph.color = new Color();
        btn.GetChild("nameTextField").asTextField.text        = goods.goodsName;
        btn.GetChild("countTextField").asTextField.text       = goods.count + "";
        btn.GetChild("descriptionTextField").asTextField.text = goods.description;
        btn.GetChild("coldDownTextField").asTextField.text    = goods.coldDownTime + "";

        //点击物品拾取,清除上次监听
        obj.onClick.Clear();
        obj.onClick.Add(() => {
            // 判断包满
            if (!GoodsUI.getGoodsDelegate(goods))
            {
                return;
            }
            box.goodsList.RemoveAt(index);
            boxList.numItems = box.goodsList.Count;
            boxList.RefreshVirtualList();
        });
    }
Example #11
0
    void Awake()
    {
#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        CopyPastePatch.Apply();
#endif

#if (UNITY_5 || UNITY_5_3_OR_NEWER)
        //Use the font names directly
        UIConfig.defaultFont = "Microsoft YaHei";
#else
        //Need to put a ttf file into Resources folder. Here is the file name of the ttf file.
        UIConfig.defaultFont = "afont";
#endif
        UIPackage.AddPackage("UI/Basics");

        UIConfig.verticalScrollBar   = UIPackage.GetItemURL("Basics", "ScrollBar_VT");
        UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ");
        UIConfig.popupMenu           = UIPackage.GetItemURL("Basics", "PopupMenu");
        UIConfig.buttonSound         = (AudioClip)UIPackage.GetItemAsset("Basics", "click");
    }
Example #12
0
    private void RenderListItem(int index, GObject obj)
    {
        GButton btn = obj.asButton;

        btn.title = "";
        btn.icon  = "";
        btn.GetChild("readyTag").visible = false;
        btn.GetChild("hostTag").visible  = false;
        if (index >= MainUI.currentRoom.currentPlayer.Count)
        {
            //btn.visible = false;
            return;
        }
        Debug.Log("渲染第" + index + "个玩家");
        obj.onClick.Add(() => { });//点击玩家显示添加好友、玩家信息列表
        btn.title = MainUI.currentRoom.currentPlayer[index].name;
        btn.icon  = UIPackage.GetItemURL("BattleCity8102", "rank" + MainUI.currentRoom.currentPlayer[index].rank);
        btn.GetChild("readyTag").visible = MainUI.currentRoom.currentPlayer[index].isReady;
        btn.GetChild("hostTag").visible  = MainUI.currentRoom.currentPlayer[index].isHost;
    }
Example #13
0
    private void SkillTypeItemRenderer(int index, GObject obj)
    {
        var item     = obj as UI_SelectTypeItem;
        var itemData = m_UI.m_ListSkillType.GetData <ItemData>(index);
        var deploy   = XinFaDeploy.GetInfo(itemData.Id);

        item.m_LabelName.text = deploy.Name;
        item.m_LabelCount.SetValue(itemData.Count);

        item.m_CondType.selectedIndex = (int)deploy.CondAttrType;
        item.m_LabelCond.SetValue(deploy.CondAttrValue);

        item.m_Type.selectedIndex = 0;
        item.m_LabelTypeValue.SetText(Language.GetQuality(deploy.Quality));

        var icon = item.m_Icon as UI_GoodsSmallIcon;

        icon.m_State.selectedIndex = 1;

        item.m_Icon.icon = UIPackage.GetItemURL("Common", deploy.Icon);
    }
Example #14
0
    private void DoSpecialEffect()
    {
        float listCenter = list.scrollPane.posX + list.viewWidth / 2;

        for (int i = 0; i < list.numChildren; i++)
        {
            GObject item       = list.GetChildAt(i);
            float   itemCenter = item.x + item.width / 2;
            float   itemWidth  = item.width;
            float   distance   = Mathf.Abs(listCenter - itemCenter);
            if (distance < itemWidth / 2)
            {
                item.SetScale(1, 1);
                GButton bt = item.asButton;
                for (int j = 0; j < 3; j++)
                {
                    if (bt.icon == UIPackage.GetItemURL("Package1", "bt" + (j + 1)))
                    {
                        currentMode = j;
                        if (currentMode == 0)
                        {
                            mainUI.GetChild("freebt").onClick.Add(() => { SceneManager.LoadScene(3); });
                        }
                        else if (currentMode == 1)
                        {
                            mainUI.GetChild("freebt").onClick.Add(() => { SceneManager.LoadScene(4); });
                        }
                        else if (currentMode == 2)
                        {
                            mainUI.GetChild("freebt").onClick.Add(() => { SceneManager.LoadScene(5); });
                        }
                    }
                }
            }
            else
            {
                item.SetScale(0.8f, 0.8f);
            }
        }
    }
Example #15
0
    /// <summary>
    /// 实现设置列表
    /// </summary>
    private void SubList()
    {
        if (list.numChildren > 6)
        {
            list.RemoveChildAt(7);
        }
        list.AddChild(list_sub);
        list_sub.AddRelation(list.GetChild("n14"), RelationType.Top_Top);
        list_sub.AddRelation(list.GetChild("n14"), RelationType.Left_Left);
        Transition t = list_sub.GetTransition("t0");

        t.Play();
        list_sub.SetPosition(list.GetChild("n0").asCom.GetChildAt(3).position.x + 120, 92, 0);
        sub.numItems           = 2;
        sub.GetChildAt(0).icon = UIPackage.GetItemURL("Lobby", "Sethover1");
        sub.GetChildAt(0).text = "Volume";
        sub.GetChildAt(1).icon = UIPackage.GetItemURL("Lobby", "Sethover2");
        sub.GetChildAt(1).text = "Logout";
        //监听列表中的按钮
        sub.GetChildAt(0).onClick.Add(VolumeAlert);
        sub.GetChildAt(1).onClick.Add(Logout);
    }
Example #16
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent <UIPanel>().ui;

        _list = _mainView.GetChild("list").asList;
        _list.RemoveChildrenToPool();
        _input = _mainView.GetChild("input").asTextInput;
        _input.onKeyDown.Add(__inputKeyDown);

        _itemURL1 = UIPackage.GetItemURL("Emoji", "chatLeft");
        _itemURL2 = UIPackage.GetItemURL("Emoji", "chatRight");

        _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn);
        _mainView.GetChild("btnEmoji").onClick.Add(__clickEmojiBtn);

        _emojiSelectUI = UIPackage.CreateObject("Emoji", "EmojiSelectUI").asCom;
        _emojiSelectUI.fairyBatching = true;
        _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji);
    }
Example #17
0
        public static void Init()
        {
            Stage.Instantiate();
            Stage.inst.referenceResolution = RESOLUTION;
            Stage.inst.matchWidthOrHeight  = 1;
            Stage.inst.updateManually      = true;

            UIConfig.defaultFont = "STHeitiSC-Medium,Droid Sans Fallback,LTHYSZK,Verdana,SimHei";

            UIPackage.AddPackage("UI/global");
            UIConfig.globalModalWaiting = UIPackage.GetItemURL("global", "ModalWaiting");
            UIConfig.windowModalWaiting = UIPackage.GetItemURL("global", "ModalWaiting");

            UIObjectFactory.SetLoaderExtension(typeof(CustomGLoader));

            UIConfig.buttonSound = ( AudioClip )UIPackage.GetItemAsset("global", "click");

            login     = new UILogin();
            hall      = new UIHall();
            room      = new UIRoom();
            loadLevel = new UILoadLevel();
            battle    = new UIBattle();
        }
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/ModalWaiting");
        UIConfig.globalModalWaiting = UIPackage.GetItemURL("ModalWaiting", "GlobalModalWaiting");
        UIConfig.windowModalWaiting = UIPackage.GetItemURL("ModalWaiting", "WindowModalWaiting");

        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("ModalWaiting", "GlobalModalWaiting"), typeof(GlobalWaiting));

        _mainView = UIPackage.CreateObject("ModalWaiting", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _testWin = new Window4();

        _mainView.GetChild("n0").onClick.Add(() => { _testWin.Show(); });

        StartCoroutine(WaitSomeTime());
    }
Example #19
0
    private void OnRefreshCreateSkillInfo(EventContext context)
    {
        m_UI.m_CreateSkillInfo.m_LabelBasePower.SetText(Data.BasePower);
        m_UI.m_CreateSkillInfo.m_LabelSkillPower.SetText(Data.SkillPower);
        m_UI.m_CreateSkillInfo.m_LabelValue.SetText(Data.Value);
        m_UI.m_CreateSkillInfo.m_LabelDiff.SetText(Data.Diff);

        m_UI.m_CreateSkillInfo.m_LabelBasePowerAdd.visible = Data.AppendAddBasePower > 0;
        m_UI.m_CreateSkillInfo.m_LabelBasePowerAdd.SetText("(" + Data.AppendAddBasePower + ")");
        m_UI.m_CreateSkillInfo.m_LabelSkillPowerAdd.visible = Data.AppendAddSkillPower > 0;
        m_UI.m_CreateSkillInfo.m_LabelSkillPowerAdd.SetText("(" + Data.AppendAddSkillPower + ")");

        ShowUpTipsCd -= 1;
        if (ShowUpTipsCd <= 0)
        {
            int[] values = { Data.LastAddBasePower, Data.LastAddSkillPower, Data.LastAddValue, Data.LastAddDiff };
            int   index  = UnityEngine.Random.Range(0, 4);
            m_UI.m_LoaderUpIcon.icon = UIPackage.GetItemURL("Common", IconUrls[index]);
            m_UI.m_LabelUpValue.SetValue(values[index]);
            m_UI.GetTransition("UpTips").Play();
            ShowUpTipsCd = 3;
        }
    }
Example #20
0
    public static string GetGoodsUrl(EGoodsType type, int id)
    {
        switch (type)
        {
        case EGoodsType.DaoJu:
            return(UIPackage.GetItemURL("Common", "IconGoods_" + id));

        case EGoodsType.XinFa:
            return(UIPackage.GetItemURL("Common", "IconXinFa_" + id));

        case EGoodsType.CanBen:
            return(UIPackage.GetItemURL("Common", "IconZhaoShi_" + id));

        case EGoodsType.WuXue:
            var info = UniqueSkillProxy.instance.GetData(id);
            return(UIPackage.GetItemURL("Common", "IconUniqueSkillBook_" + info.SkillEffectId));

        case EGoodsType.HuoBi:
            return(UIPackage.GetItemURL("Common", "IconHuoBi_" + id));
        }

        return("");
    }
    /// <summary>
    /// 响应卡牌堆内卡牌点击事件的函数
    /// </summary>
    /// <param name="context"></param>
    public void OnClickCardInCardSets(EventContext context)
    {
        // 先获取到点击的下标
        int index = _cardsSetsList.GetChildIndex(context.data as GObject);

        // 通过下标获取到id
        string cardId = cardSetsList[index];

        // 测试,直接把卡牌放入手牌中
        CardManager.Instance().InsertIntoHandCard(cardId);


        // 向数据库查询展示数据
        JsonData data = CardManager.Instance().GetCardJsonData(cardId);

        _abstractText.text = "姓名:" + data["name"] + "\n" + "类型:" + data["type"];

        _storyText.text = "这里本来该有卡牌故事但是现在没有数据\n" + data["effect"];

        // TODO: 根据策划案加载icon

        _picLoader.url = UIPackage.GetItemURL(cardBookPicAssets, cardId);
    }
Example #22
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Particles");

        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("Particles", "CoolComponent"), typeof(CoolComponent));

        _mainView = UIPackage.CreateObject("Particles", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        Object     prefab = Resources.Load("Flame");
        GameObject go     = (GameObject)Object.Instantiate(prefab);

        _mainView.GetChild("holder").asGraph.SetNativeObject(new GoWrapper(go));

        _mainView.GetChild("c0").draggable = true;
        _mainView.GetChild("c1").draggable = true;
    }
Example #23
0
    void Start()
    {
        Application.targetFrameRate = 60;
        DontDestroyOnLoad(this.gameObject);

        Stage.Instantiate(5);
        Stage.inst.AddChild(new GRoot().displayObject);
        Stage.inst.camera.clearFlags = CameraClearFlags.Depth;

        if (Application.isMobilePlatform)
        {
            GRoot.inst.SetContentScaleFactor(640, 960);
        }

        UIPackage.AddPackage("demo");

        UIConfig.defaultFont         = "arial";
        UIConfig.verticalScrollBar   = UIPackage.GetItemURL("Demo", "ScrollBar_VT");
        UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Demo", "ScrollBar_HZ");
        UIConfig.popupMenu           = UIPackage.GetItemURL("Demo", "PopupMenu");

        new MainPanel();
    }
Example #24
0
    void AddMsg(string sender, string senderIcon, string msg, bool fromMe)
    {
        bool isScrollBottom = _list.scrollPane.isBottomMost;

        GButton item = _list.AddItemFromPool(fromMe ? _itemURL2 : _itemURL1).asButton;

        if (!fromMe)
        {
            item.GetChild("name").text = sender;
        }
        item.icon = UIPackage.GetItemURL("Emoji", senderIcon);

        //Recaculate the text width
        GRichTextField tf = item.GetChild("msg").asRichTextField;

        tf.width = tf.initWidth;
        tf.text  = EmojiParser.inst.Parse(msg);
        tf.width = tf.textWidth;

        if (fromMe)
        {
            if (_list.numChildren == 1 || Random.Range(0f, 1f) < 0.5f)
            {
                AddMsg("FairyGUI", "r1", "Today is a good day. [:gz]", false);
            }
        }

        if (_list.numChildren > 30)
        {
            _list.RemoveChildrenToPool(0, _list.numChildren - 30);
        }

        if (isScrollBottom)
        {
            _list.scrollPane.ScrollBottom(true);
        }
    }
Example #25
0
    void Start()
    {
        Application.targetFrameRate = 60;
        DontDestroyOnLoad(this.gameObject);

        Stage.Instantiate(5);
        Stage.inst.AddChild(new GRoot().displayObject);
        Stage.inst.camera.clearFlags = CameraClearFlags.Depth;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        GRoot.inst.SetContentScaleFactor(1136, 640);

        UIPackage.AddPackage("UI/EmojiDemo");

        UIConfig.verticalScrollBar       = UIPackage.GetItemURL("Demo", "ScrollBar_VT");
        UIConfig.defaultScrollBarDisplay = ScrollBarDisplayType.Auto;

        _mainView = UIPackage.CreateObject("Demo", "Main").asCom;
        _mainView.SetSize(GRoot.inst.width, GRoot.inst.height);
        _mainView.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_mainView);

        _list = _mainView.GetChild("list").asList;
        _list.RemoveChildrenToPool();
        _input = _mainView.GetChild("input").asTextInput;
        _input.onKeyDown.Add(__inputKeyDown);

        _itemURL1 = UIPackage.GetItemURL("Demo", "chatLeft");
        _itemURL2 = UIPackage.GetItemURL("Demo", "chatRight");

        _mainView.GetChild("btnSend").onClick.Add(__clickSendBtn);
        _mainView.GetChild("btnEmoji").onClick.Add(__clickEmojiBtn);

        _emojiSelectUI = UIPackage.CreateObject("Demo", "EmojiSelectUI").asCom;
        _emojiSelectUI.GetChild("list").asList.onClickItem.Add(__clickEmoji);
    }
Example #26
0
 override protected void refresh()
 {
     title.text   = entity.config.showName;
     archIcon.url = UIPackage.GetItemURL("Icon", entity.config.id);
 }
Example #27
0
 public static void SetAnimalIcon(this GLoader loader, int animalId)
 {
     loader.icon = UIPackage.GetItemURL("Common", "IconAnimal_" + animalId);
 }
Example #28
0
    void Awake()
    {
        UIPackage.AddPackage("UI/Particles");

        UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("Particles", "CoolComponent"), typeof(CoolComponent));
    }
Example #29
0
 void Awake()
 {
     UIPackage.AddPackage("VirtualList");
     UIObjectFactory.SetPackageItemExtension(UIPackage.GetItemURL("VirtualList", "mailItem"), typeof(MailItem));
 }
Example #30
0
    private void OnRenderItem(int index, GObject item)
    {
        GButton btn = item.asButton;

        btn.icon = UIPackage.GetItemURL("Package04", "n" + (index + 1));
    }