Esempio n. 1
0
 public void BustedSynthStatus()
 {
     // 0 Durability and < max progress is busted.
     Engine.State state = Utility.CreateDefaultState();
     state.Durability    = 0;
     state.MaxDurability = 20;
     state.MaxProgress   = 20;
     state.Progress      = state.MaxProgress - 1;
     Assert.AreEqual <Engine.SynthesisStatus>(Engine.SynthesisStatus.BUSTED, state.Status);
 }
Esempio n. 2
0
        public void InProgressSynthStatus()
        {
            Engine.State state = Utility.CreateDefaultState();


            state.MaxProgress   = 20;
            state.Progress      = state.MaxProgress - 1;
            state.MaxDurability = 20;
            state.Durability    = 10;
            Assert.AreEqual <Engine.SynthesisStatus>(Engine.SynthesisStatus.IN_PROGRESS, state.Status);
        }
Esempio n. 3
0
        public void TestProgressFormulaByObservation1()
        {
            Engine.State state = Utility.CreateDefaultState();
            state.Control       = 102;
            state.Craftsmanship = 105;
            state.CrafterLevel  = 17;
            state.SynthLevel    = 19;

            uint progress = Compute.Progress(state, (SynthAction <CompletionActionAttribute, BasicSynthesis> .Attributes.Efficiency));

            Assert.AreEqual <uint>(19, progress);
        }
Esempio n. 4
0
        public void BustedSynthWorthNothing()
        {
            Engine.State state = Utility.CreateDefaultState();

            state.Durability    = 0;
            state.MaxDurability = 70;

            state.Progress    = 50;
            state.MaxProgress = 70;

            Assert.AreEqual <SynthesisStatus>(Engine.SynthesisStatus.BUSTED, state.Status);
            Assert.AreEqual <double>(0.0, state.Score);
        }
Esempio n. 5
0
        private void HandleEngineCheck(Engine engine, Engine.State state)
        {
            if (state == Engine.State.SomethingWrong)
            {
                Debug.Log("ERROR: Engine flaw is found from " + engine.gameObject.name);
                OnDetectEngineFlawEvent.Invoke();
                return;
            }

            if (--engineCheckCountLeft == 0)
            {
                OnEnginesReadyEvent?.Invoke();
            }
        }
Esempio n. 6
0
        private void HandleEngineOff(Engine engine, Engine.State state)
        {
            if (state != Engine.State.Off)
            {
                Debug.Log("ERROR: Failed on turning off Engine : " + engine.gameObject.name);
                OnTurningOffEngineFailedEvent?.Invoke();
                return;
            }

            if (--engineCheckCountLeft == 0)
            {
                OnEnginesOffEvent?.Invoke();
            }
        }
Esempio n. 7
0
        public void CompletedSynthStatus()
        {
            Engine.State state = Utility.CreateDefaultState();

            // Max Progress and non-zero durability is completed.
            state.MaxProgress   = 20;
            state.Progress      = state.MaxProgress;
            state.MaxDurability = 10;
            state.Durability    = 10;
            Assert.AreEqual <Engine.SynthesisStatus>(Engine.SynthesisStatus.COMPLETED, state.Status);

            // Max Progress and zero durability is completed.
            state.Durability = 0;
            Assert.AreEqual <Engine.SynthesisStatus>(Engine.SynthesisStatus.COMPLETED, state.Status);
        }
Esempio n. 8
0
 // Creates a state which is in progress (i.e. not busted, not complete)
 // with non-zero CP and max cp.
 public static Engine.State CreateDefaultState()
 {
     Engine.State result = new Engine.State();
     result.Condition     = Engine.Condition.Normal;
     result.Control       = 102;
     result.Craftsmanship = 105;
     result.Durability    = 70;
     result.MaxDurability = 70;
     result.Progress      = 0;
     result.MaxProgress   = 63;
     result.Quality       = 0;
     result.MaxQuality    = 512;
     result.CP            = 213;
     result.MaxCP         = 213;
     return(result);
 }
Esempio n. 9
0
        private void flatButtonTimerDrop_Click(object sender, EventArgs e)
        {
            if (this.timerDrop.Enabled)
            {
                return;
            }
            if ((__TimerDropMin = this.flatNumericTimerDrop.Value) <= 0)
            {
                __Set_AlertMsg(FlatAlertBox._Kind.Error, Properties.Resources.AlertDropError1);
                return;
            }

            Task <Engine.State> t1 = stRv.BeginBlockTimerT(__TimerDropMin);

            t1.ContinueWith((o) =>
            {
                Engine.State st = o.Result;
                switch (st)
                {
                case Engine.State.ListSuccess:
                    {
                        __Set_AlertMsg(
                            FlatAlertBox._Kind.Success,
                            Properties.Resources.AlertDropError3
                            );
                        break;
                    }

                case Engine.State.ServerBusy:
                    {
                        __Set_AlertMsg(
                            FlatAlertBox._Kind.Error,
                            Properties.Resources.AlertDropError2
                            );
                        return;
                    }

                case Engine.State.ServerError:
                    {
                        __Set_AlertMsg(
                            FlatAlertBox._Kind.Error,
                            Properties.Resources.AlertErrorServer
                            );
                        return;
                    }

                case Engine.State.ListError:
                    {
                        __Set_AlertMsg(
                            FlatAlertBox._Kind.Error,
                            Properties.Resources.AlertErrorLocal
                            );
                        return;
                    }

                default:
                    {
                        __Set_AlertMsg(
                            FlatAlertBox._Kind.Error,
                            string.Format(
                                Properties.Resources.AlertOtherError,
                                st.ToString()
                                )
                            );
                        return;
                    }
                }
                __SetupFolder_Text(__ButtonState.Desabled);
                flatThreadSafe.Run(this, (Action)(() => __isRaisingEvents = this.fileSystemWatch.EnableRaisingEvents));
                __Set_LogMsg(string.Format(Properties.Resources.fmtStatusDropStart, __TimerDropMin));
                flatThreadSafe.Run(this, (Action)(() => __TimerDropMin = (__TimerDropMin * 60)));
                flatThreadSafe.Run(this, (Action)(() => this.timerDrop.Enabled = true));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonTimerDrop.Enabled = false));
                flatThreadSafe.Run(this, (Action)(() => this.flatButtonStartStop.Enabled = false));
                __FileWatcher_Run(false);
                o.Dispose();
            }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.NotOnCanceled);
            t1.ContinueWith((o) =>
            {
                __Set_LogMsg(
                    string.Format(
                        Properties.Resources.LogTaskError,
                        o.Status.ToString()
                        )
                    );
                o.Dispose();
            }, TaskContinuationOptions.OnlyOnFaulted);
        }
Esempio n. 10
0
 public StateFrame(Engine.State state)
 {
     this.state = new Engine.State.Manager(state);
     Focusable  = true;
 }
Esempio n. 11
0
 public StateFrame(Engine.State state, Vec2 size) : this(state) {
     Size = size;
 }
Esempio n. 12
0
 public StateFrame(Engine.State state, double width, double height) : this(state) {
     Size = new Vec2(width, height);
 }