コード例 #1
0
ファイル: RealmLiveTests.cs プロジェクト: MBmasher/osu
        public void TestValueAccessWithOpenContext()
        {
            RunTestWithRealm((realmFactory, _) =>
            {
                ILive <RealmBeatmap>?liveBeatmap = null;
                Task.Factory.StartNew(() =>
                {
                    using (var threadContext = realmFactory.CreateContext())
                    {
                        var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));

                        liveBeatmap = beatmap.ToLive();
                    }
                }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();

                Debug.Assert(liveBeatmap != null);

                Task.Factory.StartNew(() =>
                {
                    Assert.DoesNotThrow(() =>
                    {
                        using (realmFactory.CreateContext())
                        {
                            var resolved = liveBeatmap.Value;

                            Assert.IsTrue(resolved.Realm.IsClosed);
                            Assert.IsTrue(resolved.IsValid);

                            // can access properties without a crash.
                            Assert.IsFalse(resolved.Hidden);
                        }
                    });
                }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();
            });
        }
コード例 #2
0
ファイル: RealmLiveTests.cs プロジェクト: roridev/osu
        public void TestScopedReadWithoutContext()
        {
            RunTestWithRealm((realmFactory, _) =>
            {
                ILive <RealmBeatmap>?liveBeatmap = null;
                Task.Factory.StartNew(() =>
                {
                    using (var threadContext = realmFactory.CreateContext())
                    {
                        var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));

                        liveBeatmap = beatmap.ToLive(realmFactory);
                    }
                }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();

                Debug.Assert(liveBeatmap != null);

                Task.Factory.StartNew(() =>
                {
                    liveBeatmap.PerformRead(beatmap =>
                    {
                        Assert.IsTrue(beatmap.IsValid);
                        Assert.IsFalse(beatmap.Hidden);
                    });
                }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();
            });
        }
コード例 #3
0
        public void TestScoreImportThenDelete()
        {
            ILive <ScoreInfo> imported = null;

            AddStep("create button without replay", () =>
            {
                Child = downloadButton = new TestReplayDownloadButton(getScoreInfo(false))
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                };
            });

            AddUntilStep("wait for load", () => downloadButton.IsLoaded);

            AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);

            AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)).Result);

            AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable);

            AddStep("delete score", () => scoreManager.Delete(imported.Value));

            AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
        }
コード例 #4
0
ファイル: RealmLiveTests.cs プロジェクト: roridev/osu
        public void TestValueAccessWithoutOpenContextFails()
        {
            RunTestWithRealm((realmFactory, _) =>
            {
                ILive <RealmBeatmap>?liveBeatmap = null;
                Task.Factory.StartNew(() =>
                {
                    using (var threadContext = realmFactory.CreateContext())
                    {
                        var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));

                        liveBeatmap = beatmap.ToLive(realmFactory);
                    }
                }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();

                Debug.Assert(liveBeatmap != null);

                Task.Factory.StartNew(() =>
                {
                    Assert.Throws <InvalidOperationException>(() =>
                    {
                        var unused = liveBeatmap.Value;
                    });
                }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();
            });
        }
コード例 #5
0
ファイル: Skin.cs プロジェクト: bdach/osu
        protected Skin(SkinInfo skin, IStorageResourceProvider resources, [CanBeNull] Stream configurationStream = null)
        {
            SkinInfo       = skin.ToLive();
            this.resources = resources;

            configurationStream ??= getConfigurationStream();

            if (configurationStream != null)
            {
                // stream will be closed after use by LineBufferedReader.
                ParseConfigurationStream(configurationStream);
            }
            else
            {
                Configuration = new SkinConfiguration();
            }

            // skininfo files may be null for default skin.
            SkinInfo.PerformRead(s =>
            {
                // we may want to move this to some kind of async operation in the future.
                foreach (SkinnableTarget skinnableTarget in Enum.GetValues(typeof(SkinnableTarget)))
                {
                    string filename = $"{skinnableTarget}.json";

                    // skininfo files may be null for default skin.
                    var fileInfo = s.Files.FirstOrDefault(f => f.Filename == filename);

                    if (fileInfo == null)
                    {
                        continue;
                    }

                    byte[] bytes = resources?.Files.Get(fileInfo.File.GetStoragePath());

                    if (bytes == null)
                    {
                        continue;
                    }

                    try
                    {
                        string jsonContent      = Encoding.UTF8.GetString(bytes);
                        var deserializedContent = JsonConvert.DeserializeObject <IEnumerable <SkinnableInfo> >(jsonContent);

                        if (deserializedContent == null)
                        {
                            continue;
                        }

                        DrawableComponentInfo[skinnableTarget] = deserializedContent.ToArray();
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(ex, "Failed to load skin configuration.");
                    }
                }
            });
        }
コード例 #6
0
ファイル: RealmLiveTests.cs プロジェクト: MBmasher/osu
        public void TestLiveAssumptions()
        {
            RunTestWithRealm((realmFactory, _) =>
            {
                int changesTriggered = 0;

                using (var updateThreadContext = realmFactory.CreateContext())
                {
                    updateThreadContext.All <RealmBeatmap>().SubscribeForNotifications(gotChange);
                    ILive <RealmBeatmap>?liveBeatmap = null;

                    Task.Factory.StartNew(() =>
                    {
                        using (var threadContext = realmFactory.CreateContext())
                        {
                            var ruleset = CreateRuleset();
                            var beatmap = threadContext.Write(r => r.Add(new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));

                            // add a second beatmap to ensure that a full refresh occurs below.
                            // not just a refresh from the resolved Live.
                            threadContext.Write(r => r.Add(new RealmBeatmap(ruleset, new RealmBeatmapDifficulty(), new RealmBeatmapMetadata())));

                            liveBeatmap = beatmap.ToLive();
                        }
                    }, TaskCreationOptions.LongRunning | TaskCreationOptions.HideScheduler).Wait();

                    Debug.Assert(liveBeatmap != null);

                    // not yet seen by main context
                    Assert.AreEqual(0, updateThreadContext.All <RealmBeatmap>().Count());
                    Assert.AreEqual(0, changesTriggered);

                    var resolved = liveBeatmap.Value;

                    // retrieval causes an implicit refresh. even changes that aren't related to the retrieval are fired at this point.
                    Assert.AreEqual(2, updateThreadContext.All <RealmBeatmap>().Count());
                    Assert.AreEqual(1, changesTriggered);

                    // even though the realm that this instance was resolved for was closed, it's still valid.
                    Assert.IsTrue(resolved.Realm.IsClosed);
                    Assert.IsTrue(resolved.IsValid);

                    // can access properties without a crash.
                    Assert.IsFalse(resolved.Hidden);

                    updateThreadContext.Write(r =>
                    {
                        // can use with the main context.
                        r.Remove(resolved);
                    });
                }

                void gotChange(IRealmCollection <RealmBeatmap> sender, ChangeSet changes, Exception error)
                {
                    changesTriggered++;
                }
            });
        }
コード例 #7
0
 private void assertImportedOnce(ILive <SkinInfo> import1, ILive <SkinInfo> import2)
 {
     import1.PerformRead(i1 => import2.PerformRead(i2 =>
     {
         Assert.That(i2.ID, Is.EqualTo(i1.ID));
         Assert.That(i2.Hash, Is.EqualTo(i1.Hash));
         Assert.That(i2.Files.First(), Is.EqualTo(i1.Files.First()));
     }));
 }
コード例 #8
0
ファイル: Warrior.cs プロジェクト: Dieho/Hero
 public void LvlUp(ILive hero)
 {
     //var b=new BleedingSting();
     //   hero.battleSkills.Add(b);
        foreach (var i in BattleSkillEnum.BattleSkills)
        {
        if (i.SkillCondition(hero))
            hero.battleSkills.Add(i as IBattleSkill);
        }
 }
コード例 #9
0
ファイル: RealmLiveTests.cs プロジェクト: roridev/osu
        public void TestLiveEquality()
        {
            RunTestWithRealm((realmFactory, _) =>
            {
                ILive <RealmBeatmap> beatmap = realmFactory.CreateContext().Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata()))).ToLive(realmFactory);

                ILive <RealmBeatmap> beatmap2 = realmFactory.CreateContext().All <RealmBeatmap>().First().ToLive(realmFactory);

                Assert.AreEqual(beatmap, beatmap2);
            });
        }
コード例 #10
0
ファイル: SkinSection.cs プロジェクト: roridev/osu
        private void updateSelectedSkinFromConfig()
        {
            ILive <SkinInfo> skin = null;

            if (Guid.TryParse(configBindable.Value, out var configId))
            {
                skin = skinDropdown.Items.FirstOrDefault(s => s.ID == configId);
            }

            dropdownBindable.Value = skin ?? skinDropdown.Items.First();
        }
コード例 #11
0
        /// <summary>Creates a new instance of Poloniex API .NET's client service.</summary>
        /// <param name="publicApiKey">Your public API key.</param>
        /// <param name="privateApiKey">Your private API key.</param>
        public PoloniexClient(string publicApiKey, string privateApiKey)
        {
            var apiWebClient = new ApiWebClient(Helper.ApiUrlHttpsBase);

            Authenticator = new Authenticator(apiWebClient, publicApiKey, privateApiKey);

            Markets = new Markets(apiWebClient);
            Trading = new Trading(apiWebClient);
            Wallet = new Wallet(apiWebClient);
            Live = new Live();
        }
コード例 #12
0
        public void TestLiveCastability()
        {
            RunTestWithRealm((realmFactory, _) =>
            {
                RealmLive <RealmBeatmap> beatmap = realmFactory.CreateContext().Write(r => r.Add(new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata()))).ToLive();

                ILive <IBeatmapInfo> iBeatmap = beatmap;

                Assert.AreEqual(0, iBeatmap.Value.Length);
            });
        }
コード例 #13
0
        /// <summary>Creates a new instance of Poloniex API .NET's client service.</summary>
        /// <param name="publicApiKey">Your public API key.</param>
        /// <param name="privateApiKey">Your private API key.</param>
        public PoloniexClient(string publicApiKey, string privateApiKey)
        {
            var apiWebClient = new ApiWebClient(Helper.ApiUrlHttpsBase);

            Authenticator = new Authenticator(apiWebClient, publicApiKey, privateApiKey);

            Markets = new Markets(apiWebClient);
            Trading = new Trading(apiWebClient);
            Wallet  = new Wallet(apiWebClient);
            Live    = new Live();
        }
コード例 #14
0
ファイル: BatleCalculates.cs プロジェクト: Dieho/Hero
 public void LvlUp(ILive hero)
 {
     hero.Lvl++;
         hero.experienceToLvl += (int)(hero.experienceToLvl*0.5);
         switch (hero.Type)
         {
             case "Warrior":
                 var w=new Warrior();
                 w.LvlUp(hero);
                 break;
         }
 }
コード例 #15
0
ファイル: Fight.cs プロジェクト: Dieho/Hero
        public string Kick(ILive first, ILive second, IBattleSkill skill = null)
        {
            var batleRandom = new BatleCalculates();
            string result = "";
            if (first.HPCurent > 0 && second.HPCurent > 0)
            {
                bool chance = batleRandom.ChanceToHit(first);
                if (!chance)
                {
                    result = "You MISS!";
                }
                else
                {
                    if (skill == null)
                        second.HPCurent = second.HPCurent - batleRandom.Damage(first) / second.DefCurent;
                    else
                    {
                        first.skillInUse.Add(skill as Skill);
                        second.HPCurent = second.HPCurent - skill.Smash(first, second) / second.DefCurent;
                    }

                }
                if (first.HPCurent > 0 && second.HPCurent > 0)
                {
                    chance = batleRandom.ChanceToHit(second);

                    if (!chance)
                        result += "He MISS!Ha-Ha";
                    else
                    {
                        first.HPCurent = first.HPCurent - batleRandom.Damage(second) / first.DefCurent;
                    }
                }
                GoEffect(first, second);
            }

            if (first.HPCurent <= 0)
            {
                first.HPCurent = 0;
                result += "You are dead!:(";
                batleRandom.Experience(second, first);
            }
            if (second.HPCurent <= 0)
            {
                second.HPCurent = 0;
                result += "He is dead!:)";
                batleRandom.Experience(first, second);
            }

            return result;
        }
コード例 #16
0
        private void assertCorrectMetadata(ILive <SkinInfo> import1, string name, string creator, OsuGameBase osu)
        {
            import1.PerformRead(i =>
            {
                Assert.That(i.Name, Is.EqualTo(name));
                Assert.That(i.Creator, Is.EqualTo(creator));

                // for extra safety let's reconstruct the skin, reading from the skin.ini.
                var instance = i.CreateInstance((IStorageResourceProvider)osu.Dependencies.Get(typeof(SkinManager)));

                Assert.That(instance.Configuration.SkinInfo.Name, Is.EqualTo(name));
                Assert.That(instance.Configuration.SkinInfo.Creator, Is.EqualTo(creator));
            });
        }
コード例 #17
0
ファイル: burning.cs プロジェクト: Dieho/Hero
        public void Go(ILive victim, int i)
        {
            if (victim.effects[i].Time > 0)
            {
                victim.HPCurent -= (float)0.4;
                victim.effects[i].Time -= 1;

            }
            else
            {

                victim.effects.RemoveAt(i);

            }
        }
コード例 #18
0
ファイル: StartForm.cs プロジェクト: wizard1991/HeroGame
        private void button1_Click(object sender, EventArgs e)
        {
            Fight f = new Fight();
            string result;
            result = f.Kick(hero1, hero2);
            richTextBox1.Text = richTextBox1.Text + hero1.Name + " - " + hero1.HPCurent.ToString() + " - " + hero2.Name + " " + hero2.HPCurent.ToString() + "\n" + result + " \n";
            if (hero1.HPCurent == 0 )
            {
                hero1 = null;

                button1.Enabled = false;
            }
            if( hero2.HPCurent == 0)
            {
                hero2 = null;
                button1.Enabled = false;
            }
        }
コード例 #19
0
ファイル: Fight.cs プロジェクト: wizard1991/HeroGame
        public string Kick(ILive first, ILive second)
        {
            BatleCalculates batleRandom = new BatleCalculates();
            string result = "";
            if (first.HPCurent > 0 && second.HPCurent > 0)
            {
                bool chance = batleRandom.ChanceToHit(first);
                if (!chance)
                {
                    result = "You MISS!";
                }
                else
                {
                    second.HPCurent = second.HPCurent - batleRandom.Damage(first) / second.DefCurent;
                }
                if (first.HPCurent > 0 && second.HPCurent > 0)
                {
                    chance = batleRandom.ChanceToHit(second);

                    if (!chance)
                        result += "He MISS!Ha-Ha";
                    else
                    {
                        first.HPCurent = first.HPCurent - batleRandom.Damage(second) / first.DefCurent;
                    }
                }
            }

            if (first.HPCurent <= 0)
            {
                first.HPCurent = 0;
                result += "You are dead!:(";
                batleRandom.Experience(second, first);
            }
            if (second.HPCurent <= 0)
            {
                second.HPCurent = 0;
                result += "He is dead!:)";
                batleRandom.Experience( first,second);
            }

            return result;
        }
コード例 #20
0
 /// <summary>
 /// Шанс попадания
 /// </summary>
 /// <param name="first"></param>
 /// <returns></returns>
 public bool ChanceToHit(ILive first)
 {
     var rand = new Random();
     double chanceToHit = rand.NextDouble();
     switch (first.Type)
     {
         case "Defender": if (chanceToHit > 0.8)
                 return false; break;
         case "Wizard": break;
         case "DD": if (chanceToHit > 0.9)
                 return false; break;
         case "Monster1": if (chanceToHit > 0.5)
                 return false; break;
         case "Monster2": if (chanceToHit > 0.6)
                 return false; break;
         case "Monster3": if (chanceToHit > 0.7)
                 return false; break;
     }
     return true;
 }
コード例 #21
0
ファイル: BatleCalculates.cs プロジェクト: Dieho/Hero
 /// <summary>
 /// Hit chance
 /// </summary>
 /// <param name="first"></param>
 /// <returns>bool.If True - Hit, if False - miss</returns>
 public bool ChanceToHit(ILive first)
 {
     var rand = new Random();
     Thread.Sleep(10);  // here and in future @Thread.Sleep(10);@ - for good random value. Fix before librerary compilation.
     double chanceToHit = rand.NextDouble();
     switch (first.Type)
     {
         case "Warrior": if (chanceToHit > 0.7)
                 return false; break;
         case "Wizard": break;
         case "DD": if (chanceToHit > 0.8)
                 return false; break;
         case "Monster1": if (chanceToHit > 0.5)
                 return false; break;
         case "Monster2": if (chanceToHit > 0.6)
                 return false; break;
         case "Monster3": if (chanceToHit > 0.7)
                 return false; break;
     }
     return true;
 }
コード例 #22
0
        /// <summary>Creates a new instance of Poloniex API .NET's client service.</summary>
        /// <param name="publicApiKey">Your public API key.</param>
        /// <param name="privateApiKey">Your private API key.</param>
        public PoloniexClient(string publicApiKey, string privateApiKey, bool simulated = false)
        {
            var apiWebClient = new ApiWebClient(Helper.ApiUrlHttpsBase);

            Authenticator = new Authenticator(apiWebClient, publicApiKey, privateApiKey);

            if (simulated)
            {
                Markets = new MarketsCustom(apiWebClient);
                Trading = new TradingSimulated(apiWebClient);
                Wallet  = new WalletSimulated(apiWebClient);
                Live    = new LiveCustom();
            }
            else
            {
                Markets = new MarketsCustom(apiWebClient);
                Trading = new TradingCustom(apiWebClient);
                Wallet  = new WalletCustom(apiWebClient);
                Live    = new LiveCustom();
            }
        }
コード例 #23
0
ファイル: Fight.cs プロジェクト: Dieho/Hero
        public void GoEffect(ILive first, ILive second)
        {
            for (int i = 0; i < first.effects.Count; i++)
            {
                first.effects[i].Go(first,i);
            }

            for (int i = 0; i < second.effects.Count; i++)
            {
                second.effects[i].Go(second,i);
            }

            for (int i = 0; i < first.skillInUse.Count; i++)
            {
                first.skillInUse[i].ToCollDown(first);

            }

            for (int i = 0; i < second.skillInUse.Count; i++)
            {
                second.skillInUse[i].ToCollDown(second);

            }
        }
 private void Awake()
 {
     _life     = GetComponent <ILive>();
     _animator = GetComponent <Animator>();
     _hit      = Animator.StringToHash(triggerName);
 }
コード例 #25
0
ファイル: BatleCalculates.cs プロジェクト: Dieho/Hero
 public void Experience(ILive winner, ILive loser)
 {
     winner.experience += (int)loser.HP;
 }
コード例 #26
0
ファイル: BatleCalculates.cs プロジェクト: Dieho/Hero
 public float Damage(ILive hero)
 {
     return RandomFloat(hero.DamageCurent - hero.DamageCurent / 3, hero.DamageCurent + hero.DamageCurent / 3);
 }
コード例 #27
0
 public float Damage(ILive Hero)
 {
     return RandomFloat(Hero.DamageCurent - Hero.DamageCurent / 10, Hero.DamageCurent + Hero.DamageCurent / 10);
 }
コード例 #28
0
 private void importBeatmap() => AddStep("import beatmap", () => importedBeatmap = manager.Import(CreateBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Result);
コード例 #29
0
ファイル: StartForm.cs プロジェクト: wizard1991/HeroGame
        private void button6_Click(object sender, EventArgs e)
        {
            if (hero1 == null || hero1.HPCurent == 0)
            {
                richTextBox1.Clear();
                hero1 = new Hero().SetWizard();
                richTextBox1.Text = "Welcome Wizard!";
            }
            else
            {
                hero2 = new Hero().SetWizard();
                richTextBox1.Text += "\nWelcome Wizard!\n";
                button1.Enabled = true;

            }
        }
コード例 #30
0
 public bool Equals(ILive <T>?other) => ID == other?.ID;
コード例 #31
0
ファイル: Movement.cs プロジェクト: Dieho/Hero
 public void MoveToRight(ILive hero, bool[,] arrea)
 {
     if (hero.mapPosition.X < Math.Sqrt(arrea.Length))
         hero.mapPosition = new Point(hero.mapPosition.X + 1, hero.mapPosition.Y);
 }
コード例 #32
0
ファイル: Movement.cs プロジェクト: Dieho/Hero
 public void MoveUp(ILive hero, bool[,] arrea)
 {
     if (hero.mapPosition.Y < Math.Sqrt(arrea.Length))
         hero.mapPosition = new Point(hero.mapPosition.X, hero.mapPosition.Y+1);
 }
コード例 #33
0
ファイル: StartForm.cs プロジェクト: Dieho/Hero
 public void NewFight(ILive hero)
 {
     if (_hero1 == null || _hero1.HPCurent == 0)
     {
         richTextBox1.Clear();
         _hero1 = hero;
         richTextBox1.Text = "Welcome " + _hero1.Name + "!";
         button8.Enabled = true;
     }
     else
     {
         _hero2 = hero;
         richTextBox1.Text += "\nWelcome " + _hero2.Name + "!\n";
         button1.Enabled = true;
     }
 }
コード例 #34
0
ファイル: BleedingSting.cs プロジェクト: Dieho/Hero
 public float SkillDamage(ILive you)
 {
     _skillDamage = you.DamageCurent * _damage;
     return _skillDamage;
 }
コード例 #35
0
ファイル: BleedingSting.cs プロジェクト: Dieho/Hero
 public override bool SkillCondition(ILive you)
 {
     if (you.Lvl>0&&you.Type!="Wizard")
     {return true;}
     return false;
 }
コード例 #36
0
ファイル: ISkill.cs プロジェクト: Dieho/Hero
 public virtual bool SkillCondition(ILive you)
 {
     return true;
 }
コード例 #37
0
ファイル: BleedingSting.cs プロジェクト: Dieho/Hero
 //public Eff SkillEffect
 //{
 //    get { return _skillEffect; }
 //    set { _skillEffect = value as Bleeding; }
 //}
 public float Smash(ILive you, ILive victim)
 {
     SkillDamage(you);
     victim.effects.Add(new Bleeding());
     return _skillDamage;
 }
コード例 #38
0
ファイル: ISkill.cs プロジェクト: Dieho/Hero
 public void ToCollDown(ILive you)
 {
     if (_cooldown > 0)
     {
         CoolDown--;
         isCooled = false;
     }
     else
     {
         isCooled = true;
         you.skillInUse.Remove(this);
         _cooldown = RollBack;
     }
 }
コード例 #39
0
ファイル: StartForm.cs プロジェクト: Dieho/Hero
        private void Button1Click(object sender, EventArgs e)
        {
            var f = new Fight();
            string result = f.Kick(_hero1, _hero2);
            richTextBox1.Text = richTextBox1.Text + _hero1.Name + " - " + _hero1.HPCurent.ToString() + " - " + _hero2.Name + " " + _hero2.HPCurent.ToString() + "\n" + result + " \n";
            if (_hero1.HPCurent == 0)
            {
                _hero1 = null;

                button1.Enabled = false;
                button8.Enabled = false;
            }
            if (_hero2.HPCurent == 0)
            {
                _hero2 = null;
                var asd = new BatleCalculates();
                asd.LvlUp(_hero1);
                button1.Enabled = false;
            }
            if (_hero1 != null)
            {
                if (_hero1.skillInUse.Count == 0)
                {
                    button9.Enabled = true;
                }
                else
                {
                    foreach (var i in _hero1.skillInUse)
                    {
                        if (i.Name == "BleedingSting")
                        {
                            if (i.IsCooled)
                                button9.Enabled = true;
                        }
                    }
                }
            }
        }
コード例 #40
0
ファイル: SkinSection.cs プロジェクト: roridev/osu
 protected override LocalisableString GenerateItemText(ILive <SkinInfo> item) => item.ToString();
コード例 #41
0
ファイル: StartForm.cs プロジェクト: Dieho/Hero
        private void button9_Click(object sender, EventArgs e)
        {
            foreach (Skill i in _hero1.battleSkills)
            {
                if (i.Name == "BleedingSting")
                {
                    var f = new Fight();
                    string result = f.Kick(_hero1, _hero2, i as IBattleSkill);
                    richTextBox1.Text = richTextBox1.Text + _hero1.Name + " - " + _hero1.HPCurent.ToString() + " - " +
                                        _hero2.Name + " " + _hero2.HPCurent.ToString() + "\n" + result + " \n";
                    if (_hero1.HPCurent == 0)
                    {
                        _hero1 = null;

                        button1.Enabled = false;
                        button8.Enabled = false;
                    }
                    if (_hero2.HPCurent == 0)
                    {
                        _hero2 = null;
                        var asd = new BatleCalculates();
                        asd.LvlUp(_hero1);
                        button1.Enabled = false;
                    }

                    button9.Enabled = false;
                }
                else
                {
                    MessageBox.Show("You have not this skill!");
                }
            }
        }
コード例 #42
0
ファイル: OsuGame.cs プロジェクト: bdach/osu
        private void load()
        {
            dependencies.CacheAs(this);

            dependencies.Cache(SentryLogger);

            dependencies.Cache(osuLogo = new OsuLogo {
                Alpha = 0
            });

            // bind config int to database RulesetInfo
            configRuleset = LocalConfig.GetBindable <string>(OsuSetting.Ruleset);
            uiScale       = LocalConfig.GetBindable <float>(OsuSetting.UIScale);

            var preferredRuleset = int.TryParse(configRuleset.Value, out int rulesetId)
                                   // int parsing can be removed 20220522
                ? RulesetStore.GetRuleset(rulesetId)
                : RulesetStore.GetRuleset(configRuleset.Value);

            try
            {
                Ruleset.Value = preferredRuleset ?? RulesetStore.AvailableRulesets.First();
            }
            catch (Exception e)
            {
                // on startup, a ruleset may be selected which has compatibility issues.
                Logger.Error(e, $@"Failed to switch to preferred ruleset {preferredRuleset}.");
                Ruleset.Value = RulesetStore.AvailableRulesets.First();
            }

            Ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ShortName;

            // bind config int to database SkinInfo
            configSkin = LocalConfig.GetBindable <string>(OsuSetting.Skin);
            SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID.ToString();
            configSkin.ValueChanged += skinId =>
            {
                ILive <SkinInfo> skinInfo = null;

                if (Guid.TryParse(skinId.NewValue, out var guid))
                {
                    skinInfo = SkinManager.Query(s => s.ID == guid);
                }

                if (skinInfo == null)
                {
                    if (guid == SkinInfo.CLASSIC_SKIN)
                    {
                        skinInfo = DefaultLegacySkin.CreateInfo().ToLive();
                    }
                }

                SkinManager.CurrentSkinInfo.Value = skinInfo ?? DefaultSkin.CreateInfo().ToLive();
            };
            configSkin.TriggerChange();

            IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);

            Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);

            SelectedMods.BindValueChanged(modsChanged);
            Beatmap.BindValueChanged(beatmapChanged, true);
        }
コード例 #43
0
 private void Awake()
 {
     _live = GetComponent <ILive>();
 }