コード例 #1
0
ファイル: IEvent.cs プロジェクト: Gigi220/BumSimulator
        protected virtual void FuncStart(Game Game, CancellationToken token, IValuta Price)
        {
            TimeStat daystmp = new TimeStat(Game.User.Times);

            daystmp.AddDate(Time);

            TimeStat daybuf = new TimeStat(Game.User.Times);

            daybuf.AddDays(1);
            while (true)
            {
                if (token.IsCancellationRequested)
                {
                    cts.Dispose();
                    return;
                }
                if (Game.User.Times == daybuf)
                {
                    foreach (var x in Abilities)
                    {
                        x.DoEffect();
                    }

                    daybuf = daybuf = new TimeStat(Game.User.Times);
                    daybuf.AddDays(1);
                }
                if (Game.User.Times == daystmp)
                {
                    if (CheckList != null && CheckList.Count > 0)
                    {
                        foreach (var x in CheckList)
                        {
                            if (x.Check() == false)
                            {
                                cts.Cancel();
                                cts.Dispose();
                                IsPressed = !IsPressed;
                                return;
                            }
                        }
                    }

                    NegativeAbility a = new NegativeAbility(Game.User.Valutes, Price);
                    a.DoEffect();

                    daystmp = new TimeStat(Game.User.Times);
                    daystmp.AddDate(Time);
                }
            }
        }
コード例 #2
0
ファイル: IValuta.cs プロジェクト: Gigi220/BumSimulator
        void CheckLoseEvent(TimeStat Time)
        {
            TimeStat loseday = new TimeStat(Time);

            loseday.AddDate(Settings_.daysDied);
            System.Windows.MessageBox.Show(Settings_.warningMessege);
            while (true)
            {
                if (Count > 0)
                {
                    handler = null;
                    flag    = false;
                    return;
                }
                else if (loseday.Is(Time))
                {
                    System.Windows.MessageBox.Show(DiedMessege);
                    flag = true;
                    return;
                }
            }
        }