Exemplo n.º 1
0
 public void OnEnable()
 {
     fadeLabel  = new SerializedObject(target);
     m_Target   = target as FadeLabel;
     firetime   = fadeLabel.FindProperty("firetime");
     duration   = fadeLabel.FindProperty("duration");
     TextTarget = fadeLabel.FindProperty("target");
     ActorPath  = fadeLabel.FindProperty("m_TargetPath");
     itemLength = fadeLabel.FindProperty("itemLength");
     m_Offfset  = fadeLabel.FindProperty("m_Offset");
 }
Exemplo n.º 2
0
        public SpeedState()
        {
            water   = new FancyWater(WaterLine, waterHeight, waterPoints, waterColor);
            results = new SpeedResultsState();

            scoreLabel = new TextLabel()
            {
                Font     = new Font("Arial", 30, FontStyle.Bold),
                DrawMode = UI.DrawMode.Centered,
                Location = new Point(Program.Width - 120, 60),
                Text     = "0"
            };

            scoreAddLabel = new FadeLabel()
            {
                Font       = new Font("Arial", 20, FontStyle.Bold),
                DrawMode   = UI.DrawMode.Centered,
                Location   = new Point(Program.Width - 120, 60),
                Text       = "0",
                FadeTime   = .8f,
                FadeDeltaY = -60
            };

            timeLabel = new TextLabel()
            {
                Font     = new Font("Arial", 30, FontStyle.Bold),
                DrawMode = UI.DrawMode.Centered,
                Location = new Point(Program.Width / 2, 60)
            };

            SetTimeLabel();

            Size blockSize = new Size(Program.Width / 3 + 1, Program.Height - (WaterLine + waterHeight));

            blocks    = new AnswerBlock[3];
            blocks[0] = new AnswerBlock(new Point(0, WaterLine + waterHeight), Color.Red, blockSize, "A", 0, this);
            blocks[1] = new AnswerBlock(new Point(blockSize.Width, WaterLine + waterHeight), Color.Green, blockSize, "B", 1, this);
            blocks[2] = new AnswerBlock(new Point(blockSize.Width * 2, WaterLine + waterHeight), Color.Blue, blockSize, "C", 2, this);

            ParseBoatData();

            AddBoat();
        }
Exemplo n.º 3
0
        public QuizState(int QuestionCount) : base()
        {
            this.QuestionCount = QuestionCount;

            //Set UI elements
            flags   = new FlagContainer[queueSize];
            buttons = new QuizButton[4];

            //Set question counter
            QuestionCounter = new TextLabel()
            {
                Font     = new Font("Arial", 30, FontStyle.Bold),
                DrawMode = UI.DrawMode.Centered,
                Location = new Point(currentFlagX, 40)
            };

            //Set scoring
            results = new ResultsState()
            {
                Questions      = QuestionCount,
                ScorePerAnswer = scorePerFlag
            };
            tracker = new StreakTracker()
            {
                Location = new Point(150, buttonTop + buttonHeight + (buttonSpacing / 2))
            };
            scoreLabel = new TextLabel()
            {
                Font     = new Font("Arial", 30, FontStyle.Bold),
                DrawMode = UI.DrawMode.Centered,
                Location = new Point(Program.Width - 200, buttonTop + buttonHeight + (buttonSpacing / 2)),
                Text     = "0"
            };
            scoreAddLabel = new FadeLabel()
            {
                Font       = new Font("Arial", 20, FontStyle.Bold),
                DrawMode   = UI.DrawMode.Centered,
                Location   = new Point(Program.Width - 200, buttonTop + buttonHeight + (buttonSpacing / 2)),
                Text       = "0",
                Color      = Color.Green,
                FadeTime   = .8f,
                FadeDeltaY = -100
            };

            currentFlagY = QuestionCounter.Location.Y + ((buttonTop - QuestionCounter.Location.Y) / 2);

            //Set curve for flag movement
            bezier = new BezierCurve(new PointF[] { new PointF(1, -.4f), new PointF(0.8f, 1) }, maxFreezeTime);

            //Set answer selection
            rng = new Random();

            //Add and correctly position buttons
            int[] buttonX = { Program.Width / 2 - (buttonWidth + buttonSpacing / 2), Program.Width / 2 + buttonSpacing / 2 };
            int[] buttonY = { buttonTop, buttonTop + buttonHeight + buttonSpacing };

            for (int i = 0; i < 4; i++)
            {
                buttons[i]           = new QuizButton(buttonX[i % 2], buttonY[i / 2], buttonWidth, buttonHeight, i + 1);
                buttons[i].OnSelect += ButtonPressed;
            }

            //Fill the flag queue
            for (int i = 0; i < 5; i++)
            {
                AddRandomFlag();
            }

            //Select random answers
            NextFlag();

            //Remove the flag at end of queue
            flags[queueSize - 1] = null;

            timer = new Stopwatch();
            timer.Start();
        }
Exemplo n.º 4
0
        public MainPage()
        {
            InitializeComponent();
            var home = new FadeLabel
            {
                Content = "home",
                Margin  = new Thickness(5, 0, 0, 0)
            };

            home.MouseDown += HomeButton_OnMouseDown;
            Header.Children.Add(home);

            var play = new FadeLabel
            {
                Content = "play",
                Margin  = new Thickness(5, 0, 0, 0)
            };

            play.MouseDown += PlayButton_OnMouseDown;
            Header.Children.Add(play);

            var profile = new FadeLabel
            {
                Content = "profile",
                Margin  = new Thickness(5, 0, 0, 0)
            };

            profile.MouseDown += NotReadyFeature;
            Header.Children.Add(profile);

            var shop = new FadeLabel
            {
                Content = "shop",
                Margin  = new Thickness(5, 0, 0, 0)
            };

            shop.MouseDown += NotReadyFeature;
            Header.Children.Add(shop);

            var settings = new FadeLabel
            {
                Content = "settings",
                Margin  = new Thickness(5, 0, 0, 0)
            };

            settings.MouseDown += NotReadyFeature;
            Header.Children.Add(settings);

            if (StaticVars.AccountInfo.IsDev)
            {
                var devLabel = new FadeLabel
                {
                    Content = "dev",
                    Margin  = new Thickness(5, 0, 0, 0)
                };
                devLabel.MouseDown += DevLabel_MouseDown;
                Header.Children.Add(devLabel);
            }

            UserInterfaceCore.MainPage = this;
            Load();
            foreach (var player in StaticVars.ActiveClient.Players)
            {
                var chatItem = new SmallChatItem
                {
                    PlayerNameLabel = { Content = player.Username },
                    StatusLabel     = { Content = player.Status },
                    Tag             = player
                };
                chatItem.MouseDoubleClick += item_MouseDoubleClick;

                if (player.Mobile)
                {
                    chatItem.StatusEllipse.Fill = Brushes.Orange;
                }
                else if (player.IsOnline && player.IsAway)
                {
                    chatItem.StatusEllipse.Fill = Brushes.Red;
                }
                else if (player.IsOnline)
                {
                    chatItem.StatusEllipse.Fill = Brushes.Green;
                }
                else
                {
                    chatItem.StatusEllipse.Fill = Brushes.Gray;
                }
                ChatStackPanel.Children.Add(chatItem);
            }
            StaticVars.ActiveClient.OnUpdatePlayer += OnUpdatePlayer;
        }
Exemplo n.º 5
0
        public async void Load(int id)
        {
            _id = id;
            if (_hasLoaded)
            {
                var changeData = JsonConvert.SerializeObject(new SetGameType
                {
                    BotDifficulty     = null,
                    GameCustomization = null,
                    GameType          = string.Empty,
                    MaxPartySize      = 5,
                    QueueId           = id
                });

                var change = JsonConvert.SerializeObject(new BodyHelper
                {
                    body   = changeData,
                    method = "PUT",
                    url    = $"v1/parties/{StaticVars.ActiveClient.CurrentParty.Payload.CurrentParty.PartyId}/gamemode"
                });

                var changeResult = await StaticVars.ActiveClient.RiotProxyCalls.DoLcdsProxyCallWithResponse("parties.service", "proxy",
                                                                                                            change);

                return;
            }

            _hasLoaded = true;
            TeamListView.Items.Clear();
            StaticVars.ActiveClient.RiotConnection.MessageReceived += ReadRtmpResp;
            var gamedata = JsonConvert.SerializeObject(new SetGameType
            {
                BotDifficulty     = null,
                GameCustomization = null,
                GameType          = string.Empty,
                MaxPartySize      = 5,
                QueueId           = id
            });

            var sendData = JsonConvert.SerializeObject(new BodyHelper
            {
                body   = gamedata,
                method = "PUT",
                url    = $"v1/parties/{StaticVars.ActiveClient.CurrentParty.Payload.CurrentParty.PartyId}/gamemode"
            });

            var party = await StaticVars.ActiveClient.RiotProxyCalls.DoLcdsProxyCallWithResponse("parties.service", "proxy",
                                                                                                 sendData);


            var ready = JsonConvert.SerializeObject(new BodyHelper
            {
                body   = "\"open\"",
                method = "PUT",
                url    = $"v1/parties/{StaticVars.ActiveClient.CurrentParty.Payload.CurrentParty.PartyId}/members/{StaticVars.ActiveClient.LoginDataPacket.AllSummonerData.Summoner.Puuid:D}/ready"
            });
            await StaticVars.ActiveClient.RiotProxyCalls.DoLcdsProxyCallWithResponse("parties.service", "proxy",
                                                                                     ready);

            var data = JsonConvert.DeserializeObject <PartyPayload>(party.Payload);

            StaticVars.ActiveClient.CurrentParty = data;

            _roomJid = new UserJid(data.Payload.CurrentParty.Chat.Jid + "@sec.pvp.net");
            StaticVars.ActiveClient.XmppClient.JoinRoom(_roomJid);
            StaticVars.ActiveClient.XmppClient.OnMessageRecieved += OnMessage;

            var loader = new Thread(async() =>
            {
                Thread.Sleep(1000);


                var sendData2 = JsonConvert.SerializeObject(new BodyHelper
                {
                    body   = "\"open\"",
                    method = "PUT",
                    url    = $"v1/parties/{StaticVars.ActiveClient.CurrentParty.Payload.CurrentParty.PartyId}/partytype"
                });

                await StaticVars.ActiveClient.RiotProxyCalls.DoLcdsProxyCallWithResponse("parties.service", "proxy",
                                                                                         sendData2);
            });

            loader.Start();


            var lobby = new FadeLabel
            {
                Content = "return to lobby",
                Margin  = new Thickness(5, 0, 0, 0)
            };

            UserInterfaceCore.MainPage.RightHeader.Children.Add(lobby);
            lobby.MouseDown += Lobby_MouseDown;
            TeamListView.Items.Add(new TeamControl
            {
                ProfileIcon =
                {
                    Source = new BitmapImage(new Uri(System.IO.Path.Combine(StaticVars.IcyWindLocation,
                                                                            "IcyWindAssets", "Icons",
                                                                            $"{StaticVars.ActiveClient.LoginDataPacket.AllSummonerData.Summoner.ProfileIconId}.png")))
                },
                SumId        = { Content = StaticVars.ActiveClient.LoginDataPacket.AllSummonerData.Summoner.SumId },
                SummonerName = { Content = StaticVars.ActiveClient.LoginDataPacket.AllSummonerData.Summoner.Name }
            });
            StaticVars.ActiveClient.XmppClient.SetPresence(NewPres(), PresenceType.Available, PresenceShow.Chat);
        }