示例#1
0
        private void BulletIcon_OnClick(EventContext context)
        {
            this.m_infoTip.visible = true;

            this.m_infoTip.GetChild("bg").onClick.Set(() => { this.m_infoTip.visible = false; });

            GComponent tip = this.m_infoTip.GetChild("InfoTip").asCom;

            tip.x = context.inputEvent.x;

            tip.y = context.inputEvent.y;

            BulletCfg bulletInfo = ((context.sender as GLoader).parent.data) as BulletCfg;

            tip.GetChild("n2").asLoader.url = bulletInfo.Icon;

            tip.GetChild("n4").asTextField.text = bulletInfo.Name();

            tip.GetChild("n6").asTextField.text = bulletInfo.Type();

            tip.GetChild("n8").asTextField.text = Message.Get(1088);

            GList attrList = tip.GetChild("n7").asList;

            attrList.numItems = 3;

            attrList.GetChildAt(0).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1089)}   +{bulletInfo.Attack}";

            attrList.GetChildAt(1).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1091)}  +{bulletInfo.SunderArmor}";

            attrList.GetChildAt(2).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1092)}  {bulletInfo.LoadingSpeed}";

            attrList.ResizeToFit(3);
        }
示例#2
0
    void chooseItem()
    {
        int idx = _new_item_list.selectedIndex;

        //Debug.Log (idx);
        if (items [idx].StartsWith("c"))
        {
            PlayerData.getInstance().gainComponent(items [idx]);
        }
        else if (items [idx].StartsWith("t"))
        {
            PlayerData.getInstance().gainTowerBase(items [idx]);
        }

        Vector3 posLocal = _new_item_list.GetChildAt(idx).position;

        GameManager.getInstance().initGetItemEffect(_new_item_list.LocalToGlobal(posLocal), items[idx]);
        GameManager.getInstance().finishItemGet();
        this.Hide();

        if (PlayerData.getInstance().guideStage == 11)
        {
            GuideManager.getInstance().showGuideDetail();
            PlayerData.getInstance().guideStage = 12;
        }
    }
示例#3
0
    void changeHeroDetail()
    {
        choosedHeroIdx = (_hero_list.GetFirstChildInView() + 1) % _hero_list.numItems;
        _info.text     = GameStaticData.getInstance().heroes [choosedHeroIdx].name;
        _desp.text     = GameStaticData.getInstance().heroes [choosedHeroIdx].desp;

        _hero_list.ClearSelection();
        _hero_list.GetChildAt(1).asButton.selected = true;;
    }
示例#4
0
    protected override void OnInit()
    {
        this.contentPane = UIPackage.CreateObject("UIMain", "TowerComponentPanel").asCom;
        this.Center();
        this.modal = true;

        _changes = this.contentPane.GetChild("changes").asList;

        _c_before = this.contentPane.GetChild("c_before").asTextField;
        _c_after  = this.contentPane.GetChild("c_after").asTextField;

        _components = this.contentPane.GetChild("components").asList;
        _confirm    = this.contentPane.GetChild("n2").asButton;
        _close      = this.contentPane.GetChild("close").asLoader;

        _switch = this.contentPane.GetChild("switch").asButton;
        _switch.onClick.Add(delegate() {
            isShownDetail = !isShownDetail;
            if (isShownDetail)
            {
                for (int i = 0; i < _components.numChildren; i++)
                {
                    AccesoryView v = (AccesoryView)_components.GetChildAt(i);
                    v.showDetail();
                }
            }
            else
            {
                for (int i = 0; i < _components.numChildren; i++)
                {
                    AccesoryView v = (AccesoryView)_components.GetChildAt(i);
                    v.hideDetail();
                }
            }
        });
        _switch.selected = true;

        _txt_now   = this.contentPane.GetChild("txt_now").asTextField;
        _txt_after = this.contentPane.GetChild("txt_after").asTextField;

        _close.onTouchEnd.Add(delegate() {
            Hide();
        });

        _confirm.onTouchEnd.Add(delegate() {
            if (choose == -1)
            {
                tp.unequip(idx);
            }
            else
            {
                tp.changeComponent(idx, choose);
            }
            Hide();
        });
    }
示例#5
0
    //遍历字典,显示所有物品到背包中
    public void showItemInBag()
    {
        foreach (KeyValuePair <Item, int> kvp in itemList)
        {
            int     index = 0;
            GObject obj   = _list.GetChildAt(index);

            ShowItem item = (ShowItem)obj;
            item.setIcon(index, kvp.Key.Sprite);
            item.setNumber(index, kvp.Value.ToString());
        }
    }
示例#6
0
        private void PropIcon_OnClick(EventContext context)
        {
            this.m_infoTip.visible = true;

            this.m_infoTip.GetChild("bg").onClick.Set(() => { this.m_infoTip.visible = false; });

            GComponent tip = this.m_infoTip.GetChild("InfoTip").asCom;

            tip.x = context.inputEvent.x;

            tip.y = context.inputEvent.y;

            Prop propInfo = ((context.sender as GLoader).parent.data) as Prop;

            tip.GetChild("n2").asLoader.url = propInfo.Icon;

            tip.GetChild("n4").asTextField.text = propInfo.Name();

            tip.GetChild("n6").asTextField.text = propInfo.Type();

            tip.GetChild("n8").asTextField.text = Message.Get(1088);

            GList attrList = tip.GetChild("n7").asList;

            attrList.numItems = 2;

            // 经验加成卡
            if (propInfo.Class == 1)
            {
                attrList.GetChildAt(0).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1093)}   +{propInfo.Experience}%";

                attrList.GetChildAt(1).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1095)}  +{propInfo.TotleTimes}";
            }
            // 金币加成卡
            else if (propInfo.Class == 2)
            {
                attrList.GetChildAt(0).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1094)}   +{propInfo.Gold}%";

                attrList.GetChildAt(1).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1095)}  +{propInfo.TotleTimes}";
            }
            else
            {
                Log.Error($"不存在的类别{propInfo.Class}");
            }


            attrList.ResizeToFit(2);
            //attrList.GetChildAt(1)
        }
示例#7
0
 //右列表选择框位置调整 add by tianjinpeng 2018/03/09 15:29:54
 void choicepos(int index)
 {
     if (baglist.numItems == 0)
     {
     }
     else
     {
         Vector2 screenPos      = baglist.GetChildAt(index).LocalToGlobal(Vector2.zero);
         Vector2 sPos           = new Vector2(screenPos.x - 2, screenPos.y - 1);
         Vector2 logicScreenPos = storeup.GlobalToLocal(sPos);
         //choice.position = new Vector2(logicScreenPos.x, logicScreenPos.y);
         killtweener(choicemove);
         choicemove = choice.TweenMove(logicScreenPos, 0.1f);
     }
 }
        protected override void OnInit()
        {
            listDifficulty = contentPane.GetChild("listDifficulty").asList;
            btnStartGame   = contentPane.GetChild("btnStartGame").asButton;
            btnCancel      = contentPane.GetChild("btnCancel").asButton;

            listDifficulty.selectedIndex = 0;
            listDifficulty.GetChildAt(0).asButton.GetChild("txtName").text = "简单";
            listDifficulty.GetChildAt(1).asButton.GetChild("txtName").text = "正常";
            listDifficulty.GetChildAt(2).asButton.GetChild("txtName").text = "困难";

            listDifficulty.onClickItem.Add(() => { GameMapManager.Instance.gameDifficulty = (GameDifficulty)listDifficulty.selectedIndex; });
            btnStartGame.onClick.Add(() => { SceneManager.LoadScene("test"); });
            btnCancel.onClick.Add(() => { SceneManager.LoadScene("Start"); });
        }
示例#9
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("mode", "effect" + (j + 1)))
                    {
                        currentEffect = j;
                    }
                }
            }
            else
            {
                item.SetScale(0.8f, 0.8f);
            }
        }
    }
示例#10
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

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

        _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;
            }
        }
    }
示例#11
0
    public void SetItemCaption(int index, bool isOwn, bool isEquip)
    {
        if (index < 0 || index >= _listItem.numChildren)
        {
            return;
        }
        var i = _listItem.GetChildAt(index);

        if (i == null)
        {
            return;
        }
        var bt = i.asButton;

        SetItemCaption(bt, isOwn, isEquip);
    }
示例#12
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        _mainView = this.GetComponent <UIPanel>().ui;

        _list = _mainView.GetChild("n0").asList;
        for (int i = 0; i < 10; i++)
        {
            GButton item = (GButton)_list.AddItemFromPool();
            item.title   = "hi " + i;
            item.visible = false;
        }

        _list.EnsureBoundsCorrect();

        for (int i = 0; i < 10; i++)
        {
            GButton item = (GButton)_list.GetChildAt(i);
            if (_list.IsChildInView(item))
            {
                Transition trans = item.GetTransition("t0");
                trans.Play(1, 2 * i, null);
            }
        }
    }
        void OnClickList(EventContext context)
        {
            //find out if there is an item in edit status
            //查找是否有项目处于编辑状态
            int cnt = _list.numChildren;

            for (int i = 0; i < cnt; i++)
            {
                GButton item = _list.GetChildAt(i).asButton;
                if (item.scrollPane.posX != 0)
                {
                    //Check if clicked on the button
                    if (item.GetChild("b0").asButton.IsAncestorOf(GRoot.inst.touchTarget) ||
                        item.GetChild("b1").asButton.IsAncestorOf(GRoot.inst.touchTarget))
                    {
                        return;
                    }
                    item.scrollPane.SetPosX(0, true);
                    //avoid scroll pane default behavior
                    //取消滚动面板可能发生的拉动。
                    item.scrollPane.CancelDragging();
                    _list.scrollPane.CancelDragging();
                    break;
                }
            }
        }
示例#14
0
        private void OnRoomDestroy(Packet packet)
        {
            _DTO_int sdto = (( _PACKET_HALL_ACMD_BRO_ROOM_DESTROIED )packet).dto;

            if (this._joinPopup.parent != null)
            {
                _DTO_room_info dto = ( _DTO_room_info )this._joinPopup.data;
                if (dto.roomId == sdto.value)
                {
                    GRoot.inst.HidePopup();
                }
            }
            GList list     = this._root["list"].asList;
            int   numItems = list.numItems;

            for (int i = 0; i < numItems; i++)
            {
                GComponent     item    = list.GetChildAt(i).asCom;
                _DTO_room_info roomDTO = ( _DTO_room_info )item.data;
                if (roomDTO.roomId == sdto.value)
                {
                    list.RemoveChildToPoolAt(i);
                    break;
                }
            }
        }
示例#15
0
 public void OnRrfresh()
 {
     if (this.data == null)
     {
         return;
     }
     unitUIEventArgs = this.data as MouseClickEventArgs;
     if (Unit == unitUIEventArgs.dataGameobject || unitUIEventArgs.dataGameobject == null)
     {
         return;
     }
     Unit             = unitUIEventArgs.dataGameobject;
     unitUIData       = UIManager.Instance.GetUnitUIData(unitUIEventArgs.dataGameobject.tag);
     txtUnitName.text = unitUIData.unit_UIName;
     unit_Icon.url    = "ui://UI/" + unitUIData.unit_Icon;
     txtUnitInf.text  = "        " + unitUIData.unit_UIInf;
     string[] icon = unitUIData.unit_ProdIcon.Split(',');
     string[, ] name = new string[icon.Length, 2];
     for (int i = 0; i < icon.Length; ++i)
     {
         name[i, 0] = icon[i].Split('|')[0];
         name[i, 1] = icon[i].Split('|')[1];
     }
     listProducting.numItems = icon.Length;
     for (int i = 0; i < icon.Length; i++)
     {
         GComponent gComponent = listProducting.GetChildAt(i).asCom;
         gComponent.data = new ComponentData(name[i, 0], unitUIEventArgs.dataGameobject, Convert.ToBoolean(Convert.ToInt32(name[i, 1])));
     }
 }
示例#16
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   HalfOfItemWidth = item.width / 2;
            float   itemCenter      = item.x + HalfOfItemWidth;
            //获取子项中心与列表中心的距离
            float distance = Mathf.Abs(listCenter - itemCenter);
            if (distance < HalfOfItemWidth)
            {
                //增大的时候注意,需要根据距离来缓慢增大,会有好的体验
                float distanceRange = 1 + (1 - distance / HalfOfItemWidth) * 0.2f;
                //改变缩放
                item.SetScale(distanceRange, distanceRange);
            }
            else
            {
                item.SetScale(1, 1);
            }
        }
    }
示例#17
0
    void select_nums_click(EventContext context)
    {
        _list.AddSelection(3, true);

        MailItem item = (MailItem)_list.GetChildAt(9);

        Debug.Log(item.title);
    }
示例#18
0
 void  handlerClickFloor(Vector3 point)
 {
     if (list.selectedIndex >= 0 && slotList[list.selectedIndex].checkAvailable())
     {
         slotList[list.selectedIndex].instantiateEntity(true, point);
         ItemRenderer(list.selectedIndex, list.GetChildAt(list.selectedIndex));
     }
 }
示例#19
0
 override protected void OnShown()
 {
     for (int i = 0; i < 10; i++)
     {
         GButton button = _list.GetChildAt(i).asButton;
         button.icon  = "i" + UnityEngine.Random.Range(0, 10);
         button.title = "" + UnityEngine.Random.Range(0, 100);
     }
 }
示例#20
0
 protected override void OnInit()
 {
     this.contentPane = UIPackage.CreateObject("UIRoot", "ErrorWindow").asCom;
     panel            = this.contentPane.GetChild("frame").asCom;
     contentList      = (GList)panel.GetChild("contentList");
     contentArea      = contentList.GetChildAt(0).asCom;
     txt = contentArea.GetChild("txtContent").asTextField;
     this.Center();
     this.modal = true;
 }
示例#21
0
        void updateDeskUser(int tableId, int deskId, string avatar, string nick = "")
        {
            var table    = Tables.GetChildAt(tableId - 1).asCom;
            var desk     = table.GetChild("desk" + deskId);
            var nickText = table.GetChild("nick" + deskId);
            var avatarUi = desk.asCom.GetChild("avatar").asLoader;

            avatarUi.url = avatar == null ? avatarUi.data + "" : Utils.Helper.GetReallyImagePath(avatar);
            if (avatar != null)
            {
                nickText.text    = nick;
                nickText.visible = true;
                desk.onClick.Remove(onDeskClick);
            }
            else
            {
                nickText.visible = false;
                desk.onClick.Set(onDeskClick);
            }
        }
示例#22
0
 /// <summary>
 /// 判断图案是否全部消除
 /// </summary>
 /// <returns></returns>
 bool IsFinishGame()
 {
     for (int i = 0; i < LinkList.numItems; i++)
     {
         if (LinkList.GetChildAt(i).visible)
         {
             return(false);
         }
     }
     return(true);
 }
示例#23
0
    public void ShowText(int damage, string damageType, string skillName)
    {
        int     index = _list.ItemIndexToChildIndex(TurnControl.instance._index);
        GObject obj   = _list.GetChildAt((index + 11) % 50);

        if (damageType != "True1")
        {
            if (damage == -1)
            {
                string str = EnemyStatus.instance.BaseStatus.EnemyName + "使用了" + skillName + ",但是被你闪避了!";
                _list.AddSelection(TurnControl.instance._index, true);
                MailItem item = (MailItem)obj;
                item.setText(str);
            }
            else if (damage == -2)
            {
                string str = EnemyStatus.instance.BaseStatus.EnemyName + "把你打败了";
                _list.AddSelection(TurnControl.instance._index, true);
                MailItem item = (MailItem)obj;
                item.setText(str);
            }
            else if (damage == -3)
            {
                string str = "休息并寻找下一个敌人中。。。";
                _list.AddSelection(TurnControl.instance._index, true);
                MailItem item = (MailItem)obj;
                item.setText(str);
            }
            else if (damage == -4)
            {
                string str = "发现" + EnemyStatus.instance.BaseStatus.EnemyName;
                _list.AddSelection(TurnControl.instance._index, true);
                MailItem item = (MailItem)obj;
                item.setText(str);
            }
            else
            {
                string str = EnemyStatus.instance.BaseStatus.EnemyName + "使用了" + skillName + ",对你造成了" + damage + "点" + damageType + "伤害";
                _list.AddSelection(TurnControl.instance._index, true);
                MailItem item = (MailItem)obj;
                item.setText(str);
            }
        }
        else
        {
            string str = HeroStatus.instance.BaseStatus.HeroName + "使用了" + skillName + ",回复了" + damage + "点生命";
            _list.AddSelection(TurnControl.instance._index, true);
            MailItem item = (MailItem)obj;
            item.setText(str);
        }
        TurnControl.instance._index = (TurnControl.instance._index + 1) % 50;
    }
示例#24
0
    public Rect getFirstBranch()
    {
        GObject firstItem = _branches.GetChildAt(0);
        Rect    rect      = firstItem.TransformRect(new Rect(0, 0, firstItem.width, firstItem.height), GRoot.inst);

        _branches.EnsureBoundsCorrect();

        Vector2 center   = _branches.LocalToGlobal(new Vector3(firstItem.position.x + firstItem.width / 2, firstItem.position.y + firstItem.height / 2, 0));
        Rect    trueRect = new Rect(center.x - rect.size.x / 2 - 4, center.y - rect.size.y / 2, rect.size.x + 4, rect.size.y + 4);

        //GuideManager.getInstance ()._guideLayer.setMark (GuideManager.getInstance ()._guideLayer.GlobalToLocal(center));
        return(trueRect);
    }
示例#25
0
    protected override void OnShown()
    {
        float interval = 300 / (_list.numChildren > 8?8:_list.numChildren);

        if (_list.numItems > 0)
        {
            _list.selectedIndex = 0;
            _detail.visible     = true;
            _detail.updateView(((BuildItem)_list.GetChildAt(0)).getTTInfo());
            //_detail.GetChild ("name").asTextField.text = ((BuildItem)(_list.GetChildAt(0))).Name;
        }
        _list.columnGap = (int)interval;
        BattleManager.getInstance().pause();
    }
示例#26
0
 //重写父类方法
 protected override void OnInit()
 {
     //设置contentPane
     this.contentPane = UIPackage.CreateObject("Bag2", "BagWindow").asCom;
     list             = this.contentPane.GetChild("ItemList").asList;
     //设置列表子项渲染方法
     list.itemRenderer = RenderListItem;
     //设置子项数目
     list.numItems = 20;
     //对每个子项进行监听事件的绑定
     for (int i = 0; i < list.numItems - 10; ++i)
     {
         GButton button = list.GetChildAt(i).asButton;
         button.onClick.Add(() => { ClickItem(button); });
     }
 }
示例#27
0
    void Start()
    {
        Application.targetFrameRate = 60;
        GRoot.inst.SetContentScaleFactor(1136, 640);
        Stage.inst.onKeyDown.Add(OnKeyDown);

        UIPackage.AddPackage("UI/Extension");
        UIObjectFactory.SetPackageItemExtension("ui://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;
            }
        }
    }
示例#28
0
    void DoSpecialEffect()
    {
        float midX  = roleList.scrollPane.posX + roleList.viewWidth / 2;
        int   count = roleList.numChildren;

        for (int i = 0; i < count; i++)
        {
            GObject obj  = roleList.GetChildAt(i);
            float   dist = Mathf.Abs(midX - obj.x - obj.width / 2);
            if (dist > obj.width)
            {
                obj.SetScale(1, 1);
            }
            else
            {
                float scale = 1 + (1 - dist / obj.width) * 0.25f;
                obj.SetScale(scale, scale);
            }
        }
        ShowRoleName();
    }
示例#29
0
    void DoSpecialEffect()
    {
        //change the scale according to the distance to middle
        float midX = _list.scrollPane.posX + _list.viewWidth / 2;
        int   cnt  = _list.numChildren;

        for (int i = 0; i < cnt; i++)
        {
            GObject obj  = _list.GetChildAt(i);
            float   dist = Mathf.Abs(midX - obj.x - obj.width / 2);
            if (dist > obj.width)             //no intersection
            {
                obj.SetScale(1, 1);
            }
            else
            {
                float ss = 1 + (1 - dist / obj.width) * 0.24f;
                obj.SetScale(ss, ss);
            }
        }
    }
示例#30
0
    private void DoScrollEffect()
    {
        float centerX = list.scrollPane.posX + list.viewWidth / 2;

        for (int i = 0; i < list.numChildren; i++)
        {
            GObject item  = list.GetChildAt(i);
            float   halfW = item.width / 2;
            float   itemX = item.x + halfW;
            float   dis   = Mathf.Abs(centerX - itemX);
            if (dis < halfW)
            {
                float scale = 1 + (1 - (dis / halfW)) * 0.3f;
                item.SetScale(scale, scale);
            }
            else
            {
                item.SetScale(1, 1);
            }
        }
    }