Пример #1
0
        private void InitUI()
        {
            var title = new CCLabel("冒险与编程", StringManager.GetText("GlobalFont"), 72)
            {
                Position = new CCPoint(400, 320),
                Color    = CCColor3B.Yellow
            };

            AddChild(title, 100);

            var begin = new CozySampleButton(200, 100, 200, 80)
            {
                // 测试代码
                // Text        = "开始游戏",
                Text     = StringManager.GetText("str3"),
                FontSize = 24,
                OnClick  = new Action(OnBeginButtonDown),
            };

            AddChild(begin, 100);
            dispatcher.Add(begin);

            var reg = new CozySampleButton(690, 0, 100, 50)
            {
                Text     = "注册帐号",
                FontSize = 18,
                OnClick  = new Action(OnRegisterButton),
            };

            AddChild(reg, 100);
            dispatcher.Add(reg);
        }
Пример #2
0
        private void InitUI()
        {
            EditNode = new CCLabel("", StringManager.GetText("GlobalFont"), 22)
            {
                Position    = new CCPoint(100, 120),
                AnchorPoint = CCPoint.Zero,
                Color       = CCColor3B.Blue
            };
            AddChild(EditNode, 100);

            var Goon = new CozySampleButton(631, 86, 78, 36)
            {
                Text     = "继续冒险",
                FontSize = 14,
                OnClick  = () =>
                {
                    FarmMapLogic.EnterMap(PlayerObject.Instance.Self.CurrLevel);
                }
            };

            AddChild(Goon, 100);
            dispatcher.Add(Goon);

            var MercMange = new CozySampleButton(631, 160, 78, 36)
            {
                Text     = "佣兵管理",
                FontSize = 14,
                OnClick  = () =>
                {
                    AppDelegate.SharedWindow.DefaultDirector.PushScene(new FollowerListScene());
                }
            };

            AddChild(MercMange, 100);
            dispatcher.Add(MercMange);

            var MyGoods = new CozySampleButton(631, 227, 78, 36)
            {
                Text     = "我的物品",
                FontSize = 14
            };

            AddChild(MyGoods, 100);
            dispatcher.Add(MyGoods);

            var MyFriends = new CozySampleButton(631, 299, 78, 36)
            {
                Text     = "我的好友",
                FontSize = 14
            };

            AddChild(MyFriends, 100);
            dispatcher.Add(MyFriends);
        }
Пример #3
0
        private void InitUI()
        {
            PlayerInfoLabel = new CCLabel("", "Consolas", 14)
            {
                Position = new CCPoint(37, 36),
                Color    = CCColor3B.White,
            };

            MapInfoLabel = new CCLabel("", "Consolas", 14)
            {
                Position = new CCPoint(37, 55),
                Color    = CCColor3B.White,
            };

            this.AddChild(PlayerInfoLabel, 100);
            this.AddChild(MapInfoLabel, 100);

            var Details = new CozySampleButton(542, 38, 78, 36)
            {
                Text     = "详情",
                FontSize = 14
            };

            AddChild(Details, 100);
            dispatcher.Add(Details);

            var DoCamp = new CozySampleButton(630, 38, 78, 36)
            {
                Text     = "安营",
                FontSize = 14,
                OnClick  = () =>
                {
                    FarmMapLogic.GoToCamp();
                },
            };

            AddChild(DoCamp, 100);
            dispatcher.Add(DoCamp);

            var Leave = new CozySampleButton(718, 38, 78, 36)
            {
                Text     = "离开",
                FontSize = 14,
                OnClick  = () =>
                {
                    FarmMapLogic.ExitMap();
                },
            };

            AddChild(Leave, 100);
            dispatcher.Add(Leave);
        }
Пример #4
0
        public FollowerDetailSprite()
        {
            ContentSize = new CCSize(435, 280);
            HasBorder   = true;

            CurrName    = new CCLabel("", "Consolas", 14);
            CurrDesc    = new CCLabel("", "Consolas", 14);
            CurrStar    = new CCLabel("", "Consolas", 14);
            CurrLevel   = new CCLabel("", "Consolas", 14);
            CurrAttack  = new CCLabel("", "Consolas", 14);
            CloseButton = new CozySampleButton(20, 20)
            {
                Text      = "X",
                FontSize  = 20,
                HasBorder = true,
                OnClick   = () =>
                {
                    this.Visible = false;
                }
            };
            StatusChangeButton = new CozySampleButton(40, 20)
            {
                Text      = "",
                HasBorder = true,
                OnClick   = () =>
                {
                    if (FightStatusChangeCallback != null)
                    {
                        FightStatusChangeCallback(currFollower);
                    }
                }
            };

            this.AddChild(CurrName);
            this.AddChild(CurrDesc);
            this.AddChild(CurrStar);
            this.AddChild(CurrLevel);
            this.AddChild(CurrAttack);
            this.AddChild(CloseButton);
            this.AddChild(StatusChangeButton);
            dispatcher.Add(CloseButton);
            dispatcher.Add(StatusChangeButton);

            dispatcher.AttachListener(this);
        }
Пример #5
0
        private void InitUI()
        {
            var s = VisibleBoundsWorldspace.Size;

            NameText = new CCTextField("[Name]", "Consolas", 16)
            {
                Position = new CCPoint(s.Width / 2, 400),
                AutoEdit = true,
            };
            AddChild(NameText, 100);
            FiledList.Add(NameText);

            PassText = new CCTextField("[Pass]", "Consolas", 16)
            {
                Position = new CCPoint(s.Width / 2, 350),
                AutoEdit = true,
            };
            AddChild(PassText, 100);
            FiledList.Add(PassText);

            PassRepeatText = new CCTextField("[Pass Repeat]", "Consolas", 16)
            {
                Position = new CCPoint(s.Width / 2, 300),
                AutoEdit = true,
            };
            AddChild(PassRepeatText, 100);
            FiledList.Add(PassRepeatText);

            NickNameText = new CCTextField("[NickName]", "Consolas", 16)
            {
                Position = new CCPoint(s.Width / 2, 250),
                AutoEdit = true,
            };
            AddChild(NickNameText, 100);
            FiledList.Add(NickNameText);

            CurrButton = new CozySampleButton(s.Width / 2, 100, 200, 80)
            {
                Text     = "注册账号",
                FontSize = 24,
                OnClick  = () => OnRegister()
            };
            AddChild(CurrButton, 100);
            dispatcher.Add(CurrButton);
        }
Пример #6
0
        private void PatternFollower()
        {
            int count = CurPage * 9;

            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 3; ++j)
                {
                    if (count < FollowerList.Followers.Count)
                    {
                        int index = count;

                        var item = new CozySampleListViewItem(SpriteList[index])
                        {
                            MarginTop    = 5,
                            MarginBottom = 5,
                        };

                        var button = new CozySampleButton(item.ContentSize.Width, item.ContentSize.Height)
                        {
                            OnClick = () =>
                            {
                                if (!ShowDetail.Visible)
                                {
                                    ShowDetail.CurrFollower = SpriteList[index].BindFollower;
                                    ShowDetail.Visible      = true;
                                }
                            },
                        };
                        item.AddChild(button);
                        dispatcher.Add(button);

                        SpriteList[index].Visible = true;
                        InnerList[i].AddItem(item);
                    }
                    count++;
                }
            }
        }
Пример #7
0
        private void InitUI()
        {
            var listlable = new CCLabel("佣兵列表", StringManager.GetText("GlobalFont"), 14)
            {
                Position = new CCPoint(100, 420),
                Color    = CCColor3B.White
            };

            FollowerList = PlayerObject.Instance.Self.AllFollower;
            Page         = (FollowerList.Followers.Count + 8) / 9;

            AddChild(listlable, 100);

            foreach (var obj in FollowerList.Followers)
            {
                var fs = new FollowerSprite(obj, true);
                this.AddChild(fs);
                SpriteList.Add(fs);
            }

            var listview = new CozySampleListView()
            {
                ContentSize = new CCSize(600, 330),
                HasBorder   = true,
                Position    = new CCPoint(100, 60)
            };

            this.AddChild(listview);

            InnerList = new CozySampleListView[3];
            for (int i = 0; i < 3; ++i)
            {
                InnerList[i] = new CozySampleListView()
                {
                    ContentSize = new CCSize(200, 330),
                    Orientation = Public.Controls.Enum.ControlOrientation.Vertical,
                };
                listview.AddItem(new CozySampleListViewItem(InnerList[i]));
            }

            int fight = PlayerObject.Instance.Self.FightFollower.Followers.Count;

            AllFollower = new CCLabel("总数" + fight + "/" + FollowerList.Followers.Count, StringManager.GetText("GlobalFont"), 14)
            {
                Position = new CCPoint(92, 37),
                Color    = CCColor3B.White,
            };
            AddChild(AllFollower, 100);

            PageNumber = new CCLabel((CurPage + 1) + "/" + Page, StringManager.GetText("GlobalFont"), 14)
            {
                Position = new CCPoint(389, 37),
                Color    = CCColor3B.White
            };
            AddChild(PageNumber, 100);

            ShowDetail = new FollowerDetailSprite()
            {
                Position    = new CCPoint(100, 100),
                AnchorPoint = CCPoint.Zero,
                Visible     = false,
                FightStatusChangeCallback = new Action <Follower>(OnStatusChange),
            };
            this.AddChild(ShowDetail, 201);

            LastPageButton = new CozySampleButton(473, 17, 78, 36)
            {
                Text     = "上一页",
                FontSize = 14,
                OnClick  = () => PrevPage(),
            };
            NextPageButton = new CozySampleButton(585, 17, 78, 36)
            {
                Text     = "下一页",
                FontSize = 14,
                OnClick  = () => NextPage(),
            };
            AddChild(NextPageButton, 100);
            AddChild(LastPageButton, 100);
            uidispatcher.Add(NextPageButton);
            uidispatcher.Add(LastPageButton);

            var backButton = new CozySampleButton(650, 17, 78, 36)
            {
                Text     = "返回",
                FontSize = 14,
                OnClick  = () =>
                {
                    AppDelegate.SharedWindow.DefaultDirector.PopScene();
                }
            };

            AddChild(backButton, 100);
            uidispatcher.Add(backButton);
        }