Ejemplo n.º 1
0
        public void InitAllSummaries()
        {
            LastMayorPost          = new UILargeBulletinSummary();
            LastMayorPost.OnClick += SelectPost;
            LastMayorPost.Opacity  = 0;
            DynamicOverlay.Add(LastMayorPost);

            for (int i = 0; i < MayorPostsBuffer.Length; i++)
            {
                var mayorPost = new UIMediumBulletinSummary();
                mayorPost.Opacity   = 0;
                mayorPost.OnClick  += SelectPost;
                MayorPostsBuffer[i] = mayorPost;
                DynamicOverlay.Add(mayorPost);
                if (i % 2 == 1)
                {
                    mayorPost.HSVMod = new Color(255 - 16, 255, 245, 255);
                }
            }

            for (int i = 0; i < SystemPostsBuffer.Length; i++)
            {
                var systemPost = new UISmallBulletinSummary(true);
                systemPost.OnClick  += SelectPost;
                systemPost.Opacity   = 0;
                SystemPostsBuffer[i] = systemPost;
                DynamicOverlay.Add(systemPost);
                if (i % 2 == 1)
                {
                    systemPost.HSVMod = new Color(20, 255, 240, 255);
                }
            }

            LastCommunityPost          = new UIMediumBulletinSummary(true);
            LastCommunityPost.OnClick += SelectPost;
            LastCommunityPost.Opacity  = 0;
            DynamicOverlay.Add(LastCommunityPost);

            for (int i = 0; i < CommunityPostsBuffer.Length; i++)
            {
                var communityPost = new UISmallBulletinSummary(false);
                communityPost.OnClick  += SelectPost;
                communityPost.Opacity   = 0;
                CommunityPostsBuffer[i] = communityPost;
                DynamicOverlay.Add(communityPost);
                if ((i + i / 2) % 2 == 1)
                {
                    communityPost.HSVMod = new Color(communityPost.HSVMod.R + 15, 255, 240, 255);
                }
            }
        }
Ejemplo n.º 2
0
 private void PrepareInactivePost(UIMediumBulletinSummary summary, Random rand)
 {
     UIUtils.GiveTooltip(summary);
     summary.HSVMod.G = 0;
     summary.HSVMod.B = 255;
     summary.Tooltip  = GameFacade.Strings.GetString("f120", "39");
     summary.TitleLabel.CaptionStyle.Color = new Color(51, 51, 51);
     summary.Body.CaptionStyle.Color       = new Color(70, 70, 70);
     summary.SetItem(new BulletinItem()
     {
         Subject = GameFacade.Strings.GetString("f122", rand.Next(10).ToString()),
         Body    = GameFacade.Strings.GetString("f122", (10 + rand.Next(11)).ToString()),
         Time    = 0// ClientEpoch.Now - rand.Next(60 * 60 * 24 * 7)
     });
 }
Ejemplo n.º 3
0
        public UIBulletinBoard()
        {
            var strings = GameFacade.Strings;

            var subtitleStyle = TextStyle.DefaultLabel.Clone();

            subtitleStyle.Size   = 9;
            subtitleStyle.Shadow = true;

            var pageStyle = subtitleStyle.Clone();

            pageStyle.Color = Color.White;

            var titleStyle = TextStyle.DefaultLabel.Clone();

            titleStyle.Color  = Color.White;
            titleStyle.Size   = 22;
            titleStyle.Shadow = true;

            //mayor

            MayorPostsLabel = new UILabel()
            {
                Position     = new Vector2(220, 38),
                CaptionStyle = titleStyle,
                Caption      = strings.GetString("f120", "2")
            };
            Add(MayorPostsLabel);

            MayorPostsSubtitle = new UILabel()
            {
                Position     = new Vector2(220, 72),
                Size         = new Vector2(313, 32),
                Alignment    = TextAlignment.Left | TextAlignment.Top,
                Wrapped      = true,
                CaptionStyle = subtitleStyle,
                Caption      = strings.GetString("f120", "3")
            };
            Add(MayorPostsSubtitle);

            MayorPostsPage = new UILabel()
            {
                Position     = new Vector2(0, 232),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = pageStyle,
                Caption      = strings.GetString("f120", "8", new string[] { "1" })
            };
            Add(MayorPostsPage);

            //system

            SystemPostsLabel = new UILabel()
            {
                Position     = new Vector2(20, 253 - 10),
                CaptionStyle = titleStyle,
                Caption      = strings.GetString("f120", "4")
            };
            Add(SystemPostsLabel);

            SystemPostsSubtitle = new UILabel()
            {
                Position     = new Vector2(0, 269 - 10),
                Size         = new Vector2(600 - 20, 1),
                Alignment    = TextAlignment.Right | TextAlignment.Top,
                CaptionStyle = subtitleStyle,
                Caption      = strings.GetString("f120", "5")
            };
            Add(SystemPostsSubtitle);

            SystemPostsPage = new UILabel()
            {
                Position     = new Vector2(0, 342),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = pageStyle,
                Caption      = strings.GetString("f120", "8", new string[] { "1" })
            };
            Add(SystemPostsPage);

            //community

            CommunityPostsLabel = new UILabel()
            {
                Position     = new Vector2(0, 356),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = titleStyle,
                Caption      = strings.GetString("f120", "6")
            };
            Add(CommunityPostsLabel);

            CommunityPostsSubtitle = new UILabel()
            {
                Position     = new Vector2(0, 389),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = subtitleStyle,
                Caption      = strings.GetString("f120", "7")
            };
            Add(CommunityPostsSubtitle);

            CommunityPostsPage = new UILabel()
            {
                Position     = new Vector2(0, 526),
                Size         = new Vector2(600, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = pageStyle,
                Caption      = strings.GetString("f120", "8", new string[] { "1" })
            };
            Add(CommunityPostsPage);

            InitAllSummaries();

            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            var larrow = ui.Get("bulletin_pleft.png").Get(gd);
            var rarrow = ui.Get("bulletin_pright.png").Get(gd);

            DynamicOverlay.Add(ScrollMayorLeft = new UIButton(larrow)
            {
                Position = new Vector2(31 - 6, 150), Tooltip = strings.GetString("f120", "10")
            });                                                                                                                                            //hidden on page 1
            DynamicOverlay.Add(ScrollMayorRight = new UIButton(rarrow)
            {
                Position = new Vector2(555 + 6, 150), Tooltip = strings.GetString("f120", "9")
            });                                                                                                                                             //offset up on page 1

            DynamicOverlay.Add(ScrollSystemLeft = new UIButton(larrow)
            {
                Position = new Vector2(31 - 6, 306 - 10), Tooltip = strings.GetString("f120", "10")
            });
            DynamicOverlay.Add(ScrollSystemRight = new UIButton(rarrow)
            {
                Position = new Vector2(555 + 6, 306 - 10), Tooltip = strings.GetString("f120", "9")
            });

            DynamicOverlay.Add(ScrollCommunityLeft = new UIButton(larrow)
            {
                Position = new Vector2(31 - 6, 448), Tooltip = strings.GetString("f120", "10")
            });
            DynamicOverlay.Add(ScrollCommunityRight = new UIButton(rarrow)
            {
                Position = new Vector2(555 + 6, 448), Tooltip = strings.GetString("f120", "9")
            });

            ScrollMayorLeft.OnButtonClick  += (btn) => Scroll(UIBulletinBoardType.Mayor, -1);
            ScrollMayorRight.OnButtonClick += (btn) => Scroll(UIBulletinBoardType.Mayor, 1);

            ScrollSystemLeft.OnButtonClick  += (btn) => Scroll(UIBulletinBoardType.System, -1);
            ScrollSystemRight.OnButtonClick += (btn) => Scroll(UIBulletinBoardType.System, 1);

            ScrollCommunityLeft.OnButtonClick  += (btn) => Scroll(UIBulletinBoardType.Community, -1);
            ScrollCommunityRight.OnButtonClick += (btn) => Scroll(UIBulletinBoardType.Community, 1);

            UpdateScrollButtons();
            MayorPostsScroll     = MayorPostsScroll;
            SystemPostsScroll    = SystemPostsScroll;
            CommunityPostsScroll = CommunityPostsScroll;

            PostButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            PostButton.Width               = 150;
            PostButton.Caption             = strings.GetString("f120", "12");
            PostButton.CaptionStyle        = PostButton.CaptionStyle.Clone();
            PostButton.CaptionStyle.Color  = Color.White;
            PostButton.CaptionStyle.Shadow = true;
            PostButton.CaptionStyle.Size   = 22;
            PostButton.Position            = new Vector2((600 - 150) / 2, 545);
            PostButton.OnButtonClick      += PostButton_OnButtonClick;
            Add(PostButton);

            var noPostStyle = TextStyle.DefaultLabel.Clone();

            noPostStyle.Size   = 12;
            noPostStyle.Shadow = true;
            noPostStyle.Color  = new Color(255, 153, 153);

            DynamicOverlay.Add(NoPostMayor = new UIMediumBulletinSummary()
            {
                Position = new Vector2((600 - 150) / 2, MayorMedTop),
            });

            DynamicOverlay.Add(NoPostSystem = new UISmallBulletinSummary(true)
            {
                Position = new Vector2((600 - 150) / 2, SystemTop),
            });

            DynamicOverlay.Add(NoPostCommunity = new UIMediumBulletinSummary(true)
            {
                Position = new Vector2((600 - 150) / 2, CommunityTop),
            });

            NoPostLabels = new UIMediumBulletinSummary[] { NoPostMayor, NoPostSystem, NoPostCommunity };
            var rand = new Random();

            foreach (var label in NoPostLabels)
            {
                PrepareInactivePost(label, rand);
            }

            Size = new Vector2(600, 610);

            InitBulletinItems(new BulletinItem[]
            {
            });

            //InitTestData();
        }