コード例 #1
0
        void discordHandshake()
        {
            if (RensenNegotiation.isRensenDetected)
            {
                if (!RensenNegotiation.AmIDead())
                {
                    int   score = RensenNegotiation.ReadScore();
                    int   lifes = RensenNegotiation.ReadLifes();
                    int   bombs = RensenNegotiation.ReadBombs();
                    float power = RensenNegotiation.ReadPowerPellets();
                    RensenNegotiation.Difficulty difficulty = RensenNegotiation.ReadDifficulty();

                    if (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko")
                    {
                        discord.SetPresence(new RichPresence()
                        {
                            Details = "점수: " + score + ", 난이도: " + RensenNegotiation.Difficulty2String(difficulty),
                            State   = "스펠: " + bombs + ", 잔기: " + lifes + ", 영력: " + power
                        });
                    }
                    else
                    {
                        discord.SetPresence(new RichPresence()
                        {
                            Details = "Score: " + score + ", level:" + RensenNegotiation.Difficulty2String(difficulty),
                            State   = "spells: " + bombs + ", lifes:" + lifes + " power:" + power
                        });
                    }
                }
                discord.UpdateStartTime();
            }
        }
コード例 #2
0
        public void updateInfo()
        {
            while (true)
            {
                if (RensenNegotiation.isRensenDetected)
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        rensenDetected.Content = (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko") ? "성련선을 찾았습니다." : "Detected";
                        rensenMeter.Value      = 100;



                        if (!RensenNegotiation.AmIDead())
                        {
                            int score = RensenNegotiation.ReadScore();
                            int lifes = RensenNegotiation.ReadLifes();
                            int bombs = RensenNegotiation.ReadBombs();
                            RensenNegotiation.Difficulty difficulty = RensenNegotiation.ReadDifficulty();
                            String output;
                            if (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko")
                            {
                                output = "점수:" + score
                                         + ",\n 라이프:" + lifes
                                         + ", 스펠:" + bombs
                                         + ",\n 영력:" + RensenNegotiation.ReadPowerPellets()
                                         + ", 난이도:" + RensenNegotiation.Difficulty2String(difficulty);
                            }
                            else
                            {
                                output = "Score:" + score
                                         + ", Lifes:" + lifes
                                         + ",\n Spells:" + bombs
                                         + ", Power:" + RensenNegotiation.ReadPowerPellets()
                                         + ", Difficulty:" + RensenNegotiation.Difficulty2String(difficulty);
                            }
                            scoreLabel.Content = output;
                        }
                        else
                        {
                            scoreLabel.Content = (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko") ? "유다희" : "YOU DIED";
                        }
                    }));
                }
                else
                {
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                    {
                        rensenMeter.Value      = 0;
                        rensenDetected.Content = (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko") ? "성련선을 켜세요." : "NOPE";
                    }));
                }
                Thread.Sleep(100);
            }
        }
コード例 #3
0
        public void updateInfo2Discord()
        {
            while (true)
            {
                if (RensenNegotiation.isRensenDetected)
                {
                    if (!RensenNegotiation.wasRensenDetected)
                    {
                        DiscordInit();
                        discordHandshake();
                        RensenNegotiation.wasRensenDetected = true;
                    }

                    if (!RensenNegotiation.AmIDead())
                    {
                        int   score = RensenNegotiation.ReadScore();
                        int   lifes = RensenNegotiation.ReadLifes();
                        int   bombs = RensenNegotiation.ReadBombs();
                        float power = RensenNegotiation.ReadPowerPellets();
                        RensenNegotiation.Difficulty difficulty = RensenNegotiation.ReadDifficulty();
                        if (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko")
                        {
                            discord.UpdateDetails("점수: " + score + ", 난이도: " + RensenNegotiation.Difficulty2String(difficulty));
                            discord.UpdateState("스펠: " + bombs + ", 잔기: " + lifes + ", 영력: " + power);
                        }
                        else
                        {
                            discord.UpdateDetails("Score: " + score + ", level:" + RensenNegotiation.Difficulty2String(difficulty));
                            discord.UpdateState("spells: " + bombs + ", lifes:" + lifes + " power:" + power);
                        }
                    }
                    else
                    {
                        int score = RensenNegotiation.ReadScore();
                        RensenNegotiation.Difficulty difficulty = RensenNegotiation.ReadDifficulty();
                        if (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName == "ko")
                        {
                            discord.UpdateDetails("게임오버");
                            discord.UpdateState("점수: " + score + " @ " + RensenNegotiation.Difficulty2String(difficulty));
                        }
                        else
                        {
                            discord.UpdateDetails("GAME OVER");
                            discord.UpdateState("Score: " + score + " @ " + RensenNegotiation.Difficulty2String(difficulty));
                        }
                    }
                    discord.Invoke();
                    for (int i = 1; i <= 1000; i++)
                    {
                        Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                                                                                { discordMeter.Value = i / 10; }));
                        if (!RensenNegotiation.isRensenDetected)
                        {
                            break;
                        }
                        Thread.Sleep(Config.Discord.discordSyncMS / 1000);
                    }
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate
                                                                            { discordMeter.Value = 0; }));
                }
                else
                {
                    if (discord != null)
                    {
                        discord.Dispose();
                    }
                    discord = null;
                    RensenNegotiation.wasRensenDetected = false;
                }
            }
        }