示例#1
0
        public async Task GetWatch_ReturnsWatch()
        {
            // Arrange
            var today    = DateTime.UtcNow;
            var expected = GetSingleWatch(today);

            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.GetWatchAsync(5)).ReturnsAsync(expected);
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.GetWatchAsync(5);

            // Assert
            var actionResult = Assert.IsType <ActionResult <WatchDto> >(response);
            var model        = Assert.IsAssignableFrom <WatchDto>(actionResult.Value);

            Assert.Equal(expected.Id, model.Id);
            Assert.Equal(expected.Model, model.Model);
            Assert.Equal(expected.Title, model.Title);
            Assert.Equal(expected.Gender, model.Gender);
            Assert.Equal(expected.CaseSize, model.CaseSize);
            Assert.Equal(expected.CaseMaterial, model.CaseMaterial);
            Assert.Equal(expected.DateCreated, model.DateCreated);
            Assert.Equal(expected.Brand.Id, model.Brand.Id);
            Assert.Equal(expected.Brand.Title, model.Brand.Title);
            Assert.Equal(expected.Brand.YearFounded, model.Brand.YearFounded);
            Assert.Equal(expected.Brand.Description, model.Brand.Description);
            Assert.Equal(expected.Brand.DateCreated, model.Brand.DateCreated);
            Assert.Equal(expected.MovementId, model.MovementId);
        }
示例#2
0
        public async Task CreateWatch_CreatesWatchAndReturnsNewWatch()
        {
            // Arrange
            var watchToPost         = GetWatchToPost();
            var watchPosted         = GetWatchCreatedOrUpdated();
            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.CreateWatchAsync(
                                          It.Is <Watch>(
                                              x => x.Id == 0 &&
                                              x.Model.Equals(watchToPost.Model) &&
                                              x.Title.Equals(watchToPost.Title) &&
                                              x.Gender.Equals(watchToPost.Gender) &&
                                              x.CaseSize.Equals(watchToPost.CaseSize) &&
                                              x.CaseMaterial.Equals(watchToPost.CaseMaterial) &&
                                              x.BrandId.Equals(watchToPost.BrandId) &&
                                              x.MovementId.Equals(watchToPost.MovementId)))).ReturnsAsync(watchPosted);
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.CreateWatchAsync(watchToPost);

            // Assert
            var result = Assert.IsType <ActionResult <WatchDto> >(response);
            var createdAtActionResult = Assert.IsType <CreatedAtActionResult>(response.Result);

            Assert.Equal(watchPosted.Id, createdAtActionResult.RouteValues["id"]);
            var model = Assert.IsAssignableFrom <WatchDto>(createdAtActionResult.Value);

            Assert.Equal(watchPosted.Id, model.Id);
            Assert.Equal(watchPosted.Model, model.Model);
            Assert.Equal(watchPosted.Title, model.Title);
        }
示例#3
0
        public async Task UpdateWatch_UpdatesWatch()
        {
            // Arrange
            var watchToPut          = GetWatchToPut();
            var watchUpdated        = GetWatchCreatedOrUpdated();
            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.UpdateWatchAsync(
                                          It.Is <Watch>(
                                              x => x.Id.Equals(watchToPut.Id) &&
                                              x.Model.Equals(watchToPut.Model) &&
                                              x.Title.Equals(watchToPut.Title) &&
                                              x.Gender.Equals(watchToPut.Gender) &&
                                              x.CaseSize.Equals(watchToPut.CaseSize) &&
                                              x.CaseMaterial.Equals(watchToPut.CaseMaterial) &&
                                              x.BrandId.Equals(watchToPut.BrandId) &&
                                              x.MovementId.Equals(watchToPut.MovementId)))).ReturnsAsync(true);
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.UpdateWatchAsync(watchToPut.Id, watchToPut);

            // Assert
            Assert.IsType <NoContentResult>(response);
        }
示例#4
0
    protected void OnButtonSaveReleased(object sender, EventArgs e)
    {
        if (watchController_ == null)
        {
            watchController_ = new WatchController(this);
            Console.WriteLine("Error: Failed to start watch controller (null) !");
            //validated_ = false;
            started_ = false;
        }

        if (validated_ && !started_)
        {
            watchController_.Start();             // Start connection

            // TODO: Update Watch data;
            watchController_.UpdateWatch();

            // Update Buttons and Controls
            ButtonSave.Sensitive           = false;
            ButtonTalk.Sensitive           = true;
            ButtonDead.Sensitive           = true;
            ButtonBackTeamId.Sensitive     = false;
            ButtonValidateTeamId.Sensitive = false;
        }
    }
示例#5
0
        public async Task GetWatches_CallsWatchRepositoryWithDefaultValues()
        {
            // Arrange
            var expected = GetWatches();

            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.GetWatchesAsync(null, null, null, 0, 20)).ReturnsAsync(expected);
            var mockApiConfiguration = new Mock <IApiConfiguration>();

            mockApiConfiguration.Setup(config => config.ApiPageSizeLimit).Returns(100);
            mockApiConfiguration.Setup(config => config.ApiDefaultPageSize).Returns(20);
            var controller = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.GetWatchesAsync();

            // Assert
            var actionResult = Assert.IsType <ActionResult <GetListResponse <WatchDto> > >(response);
            var listResponse = Assert.IsAssignableFrom <GetListResponse <WatchDto> >(actionResult.Value);

            Assert.Equal(expected.Total, listResponse.Total);
            Assert.Equal(expected.Count, listResponse.Count);
            Assert.Equal(expected.PageNumber, listResponse.PageNumber);
            Assert.Equal(expected.PageSize, listResponse.PageSize);
            Assert.Equal(expected.Results.Count(), listResponse.Results.Count());
        }
示例#6
0
 /// <summary>
 /// Initialize
 /// 初期化します。
 /// </summary>
 public WatchController()
 {
     //this.hungCount = 0;
     this.ProcessStatus = WatchController.processWatch();
     //this.timerCallback = new TimerCallback(this.detectHungUp);
     //this.timer = new Timer(this.timerCallback);
 }
示例#7
0
        private void timer_Tick(object sender, EventArgs e)
        {
            if (SettingController.HungUp.enable == false)
            {
                // フリーズ検出無効時
                return;
            }
            if (this.WController == null)
            {
                this.WController = new WatchController();
            }

            // クライアントの状態が変更された場合
            if (this.WController.gameStats != this.prevStatus)
            {
                SimpleLogger.WriteLine("Trickster client: " + this.WController.gameStats.ToString());
                this.prevStatus = this.WController.gameStats;
            }
            if (this.WController.ProcessStatus != this.prevProcessStatus)
            {
                SimpleLogger.WriteLine("Trickster process: " + this.WController.ProcessStatus.ToString());
                this.prevProcessStatus = this.WController.ProcessStatus;
            }

            // フリーズ判定
            int msec = SettingController.HungUp.sec * 1000;   // 単位ミリ秒

            this.WController.setTimer(timer, msec);
            notifyIcon.Text = "TSLoginManager (FREEZE MODE)";
            Thread worker = new Thread(this.WController.watcher);

            worker.IsBackground = true;
            worker.Start();
            notifyIcon.Text = "TSLoginManager";
        }
        public WatchController Build()
        {
            var controller = new WatchController(_watchService);

            controller = BuildControllerProperties(controller);

            return(controller);
        }
示例#9
0
 public bool IsWatchTabActive(string state_name)
 {
     if (!WatchController.Get().enabled)
     {
         return(false);
     }
     Watch.State state = (Watch.State)Enum.Parse(typeof(Watch.State), state_name);
     return(this.m_State == state);
 }
示例#10
0
 private void Update()
 {
     if (this.m_RotationBlocked && WatchController.Get().IsActive())
     {
         Player.Get().UnblockRotation();
         this.m_RotationBlocked = false;
     }
     else if (!this.m_RotationBlocked && !WatchController.Get().IsActive())
     {
         Player.Get().BlockRotation();
         this.m_RotationBlocked = true;
     }
 }
示例#11
0
        public async Task DeleteWatch_DeletesWatch()
        {
            // Arrange
            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.DeleteWatchAsync(15)).ReturnsAsync(true);
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.DeleteWatchAsync(15);

            // Assert
            Assert.IsType <NoContentResult>(response);
        }
示例#12
0
        public async Task GetWatches_ThrowsBadRequest_ForInvalidPageSize()
        {
            // Arrange
            var mockWatchRepository  = new Mock <IWatchRepository>();
            var mockApiConfiguration = new Mock <IApiConfiguration>();

            mockApiConfiguration.Setup(config => config.ApiPageSizeLimit).Returns(10);
            var controller = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var ex = await Assert.ThrowsAsync <BadRequestException>(() => controller.GetWatchesAsync(pageSize: 11));

            // Assert
            Assert.Equal("pageSize", ex.Key);
            Assert.Equal("Wrong value for page size: 11. Page size is expected to be in 1-10 range.", ex.Message);
        }
示例#13
0
        public async Task UpdateWatch_ThrowsBadRequest_ForMismatchingIds()
        {
            // Arrange
            var watchToPut           = GetWatchToPut();
            var mockWatchRepository  = new Mock <IWatchRepository>();
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var ex = await Assert.ThrowsAsync <BadRequestException>(
                () => controller.UpdateWatchAsync(10, watchToPut));

            // Assert
            Assert.Equal("id", ex.Key);
            Assert.Equal("Watch id 15 does not match the id in the route: 10.", ex.Message);
        }
示例#14
0
    protected void OnButtonDeadReleased(object sender, EventArgs e)
    {
        TextBoxPlayerName.Sensitive    = true;
        ButtonValidateTeamId.Sensitive = true;
        ButtonRangeTeamId.Sensitive    = true;
        ButtonBackTeamId.Sensitive     = false;
        ButtonSave.Sensitive           = false;
        ButtonTalk.Sensitive           = false;

        ButtonDead.Sensitive = false;
        started_             = false;
        validated_           = false;

        watchController_.Stop();
        watchController_ = null;
    }
示例#15
0
        public async Task GetWatch_ReturnsNotFound_ForInvalidId()
        {
            // Arrange
            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.GetWatchAsync(55)).ReturnsAsync((Watch)null);
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.GetWatchAsync(55);

            // Assert
            var result = Assert.IsType <ActionResult <WatchDto> >(response);
            var notFoundObjectResult = Assert.IsType <NotFoundObjectResult>(response.Result);

            Assert.Equal("Watch with id 55 cannot be found.", notFoundObjectResult.Value);
        }
示例#16
0
        public async Task DeleteWatch_ReturnsNotFound_ForInvalidId()
        {
            // Arrange
            var mockWatchRepository = new Mock <IWatchRepository>();

            mockWatchRepository.Setup(svc => svc.DeleteWatchAsync(15)).ReturnsAsync(false).Verifiable();
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var response = await controller.DeleteWatchAsync(15);

            // Assert
            mockWatchRepository.Verify();
            var notFoundObjectResult = Assert.IsType <NotFoundObjectResult>(response);

            Assert.Equal("Watch with id 15 cannot be found.", notFoundObjectResult.Value);
        }
示例#17
0
        public async Task UpdateWatch_ReturnsNotFound_ForEmptyId()
        {
            // Arrange
            var watchToPut = GetWatchToPut();

            watchToPut.Id = 0;
            var mockWatchRepository  = new Mock <IWatchRepository>();
            var mockApiConfiguration = new Mock <IApiConfiguration>();
            var controller           = new WatchController(mockWatchRepository.Object, mockApiConfiguration.Object);

            // Act
            var ex = await Assert.ThrowsAsync <BadRequestException>(
                () => controller.UpdateWatchAsync(0, watchToPut));

            // Assert
            Assert.Equal("id", ex.Key);
            Assert.Equal("Watch id cannot be 0.", ex.Message);
        }
示例#18
0
    private void Initialize()
    {
        LoadDefaultControls();

        watchController_ = new WatchController(this);

        DownloadWatchData();

        helper_ = new DrawingAreaMapHelper(DrawingAreaMap);

        UIHandler_ = new UIHandler(this);

        UIHandler_.Initialize();

        // TODO: remove event ?
        DrawingAreaMap.ExposeEvent += (o, args) =>
        {
            UIHandler_.ClearDrawingArea();
            UIHandler.DrawMapPoint(ColorPicker.Blue, (helper_.WindowWidth / 2) - 2, (helper_.WindowHeight / 2) - 2, 8, 8);
        };

        ButtonTalk.Clicked += (sender, e) =>
        {
            ButtonTalk.ModifyBg(StateType.Normal, ColorPicker.Red);


            talking_ = !talking_;

            if (talking_)
            {
                DisableTalk();
            }
            else
            {
                EnableTalk();
            }
        };

        Add(DrawingAreaMap);

        Show();
    }
示例#19
0
    public override void ControllerUpdate()
    {
        base.ControllerUpdate();
        bool flag = (GreenHellGame.IsPCControllerActive() && InputsManager.Get().IsActionActive(InputsManager.InputAction.RMB)) || (GreenHellGame.IsPadControllerActive() && InputsManager.Get().IsActionActive(InputsManager.InputAction.ZoomMap));

        if (flag != this.m_Animator.GetBool(this.m_ZoomHash))
        {
            this.m_Animator.SetBool(this.m_ZoomHash, flag);
        }
        if (this.m_CursorVisible && WatchController.Get().IsActive())
        {
            CursorManager.Get().ShowCursor(false, false);
            this.m_CursorVisible = false;
            return;
        }
        if (!this.m_CursorVisible && !WatchController.Get().IsActive() && GreenHellGame.IsPCControllerActive())
        {
            CursorManager.Get().ShowCursor(true, true);
            this.m_CursorVisible = true;
        }
    }
示例#20
0
    public void OnInputAction(InputActionData action_data)
    {
        if (action_data.m_Action == InputsManager.InputAction.PrevItemOrPage)
        {
            if (!WatchController.Get().IsActive())
            {
                this.SetPrevPage();
                return;
            }
        }
        else if (action_data.m_Action == InputsManager.InputAction.NextItemOrPage)
        {
            if (!WatchController.Get().IsActive())
            {
                this.SetNextPage();
                return;
            }
        }
        else if (action_data.m_Action == InputsManager.InputAction.NotepadNextTab)
        {
            switch (this.m_ActiveTab)
            {
            case MenuNotepad.MenuNotepadTab.StoryTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.MapTab:
                break;

            case MenuNotepad.MenuNotepadTab.ItemsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.PlantsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.ConstructionsTab:
                if (GreenHellGame.Instance.m_GameMode == GameMode.Survival)
                {
                    this.SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, false);
                    return;
                }
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryObjectivesTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.FirecampTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.WaterConstructionsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.TrapsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.SkillsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.MudBuildingsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.WaterConstructionsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.TrapsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.HealingItemsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.SkillsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.PlantsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.HealingItemsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.CustomConstructionsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.FirecampTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.StoryObjectivesTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.MudBuildingsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.CustomConstructionsTab, false);
                return;

            default:
                return;
            }
        }
        else if (action_data.m_Action == InputsManager.InputAction.NotepadPrevTab)
        {
            switch (this.m_ActiveTab)
            {
            case MenuNotepad.MenuNotepadTab.StoryTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryObjectivesTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.MapTab:
                break;

            case MenuNotepad.MenuNotepadTab.ItemsTab:
                if (GreenHellGame.Instance.m_GameMode == GameMode.Survival)
                {
                    this.SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, false);
                    return;
                }
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.StoryTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.ConstructionsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.TrapsTab, false);
                break;

            case MenuNotepad.MenuNotepadTab.FirecampTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.CustomConstructionsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.TrapsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.WaterConstructionsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.SkillsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.HealingItemsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.WaterConstructionsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.FirecampTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.HealingItemsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.PlantsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.PlantsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.ItemsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.CustomConstructionsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.MudBuildingsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.StoryObjectivesTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.ConstructionsTab, false);
                return;

            case MenuNotepad.MenuNotepadTab.MudBuildingsTab:
                this.SetActiveTab(MenuNotepad.MenuNotepadTab.SkillsTab, false);
                return;

            default:
                return;
            }
        }
    }
示例#21
0
 protected virtual bool CanBlock()
 {
     return(!FightController.s_BlockFight && !this.m_WasBlockBroken && !SwimController.Get().IsActive() && !Inventory3DManager.Get().gameObject.activeSelf&& !WatchController.Get().IsActive() && !MapController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress() && !Player.Get().m_Aim&& !CraftingController.Get().IsActive() && !Player.Get().m_Animator.GetBool(TriggerController.Get().m_BDrinkWater) && this.m_LastBlockTime <= Time.time - (PlayerConditionModule.Get().IsLowStamina() ? 1f : 0.5f) && !ScenarioManager.Get().IsDream() && !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"));
 }
示例#22
0
 protected virtual bool CanBlock()
 {
     return(!PlayerConditionModule.Get().IsStaminaCriticalLevel() && !SwimController.Get().IsActive() && !Inventory3DManager.Get().gameObject.activeSelf&& !WatchController.Get().IsActive() && !MapController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress() && !Player.Get().m_Aim);
 }
示例#23
0
 public void Activate()
 {
     if (CutscenesManager.Get().IsCutscenePlaying())
     {
         return;
     }
     if (base.gameObject.activeSelf)
     {
         return;
     }
     if (BodyInspectionMiniGameController.Get().IsActive())
     {
         return;
     }
     if (VomitingController.Get().IsActive())
     {
         return;
     }
     if (SwimController.Get().IsActive())
     {
         return;
     }
     if (ConsciousnessController.Get().IsActive())
     {
         return;
     }
     if (WatchController.Get().IsActive())
     {
         return;
     }
     if (SleepController.Get().IsActive())
     {
         return;
     }
     if (InsectsController.Get().IsActive())
     {
         return;
     }
     if (HarvestingAnimalController.Get().IsActive())
     {
         return;
     }
     if (HarvestingSmallAnimalController.Get().IsActive())
     {
         return;
     }
     if (Player.Get().IsDead())
     {
         return;
     }
     if (HitReactionController.Get().IsActive())
     {
         return;
     }
     if (TriggerController.Get().IsGrabInProgress())
     {
         return;
     }
     if (HUDMovie.Get().enabled&& HUDMovie.Get().gameObject.activeSelf)
     {
         return;
     }
     if (Player.Get().m_Aim || Time.time - Player.Get().m_StopAimTime < 0.5f)
     {
         return;
     }
     base.gameObject.SetActive(true);
     this.BlockPlayerRotation(true);
     if (!Player.Get().m_BodyInspectionController.IsActive() && !CraftingManager.Get().gameObject.activeSelf)
     {
         Player.Get().StartController(PlayerControllerType.Inventory);
         if (Player.Get().m_ControllerToStart != PlayerControllerType.Unknown)
         {
             Player.Get().StartControllerInternal();
         }
     }
     this.m_Camera.enabled = true;
     this.m_Canvas.gameObject.SetActive(true);
     CursorManager.Get().ShowCursor(true);
     HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Inventory3D);
     this.m_CarriedItem = null;
     this.SetupPocket(this.m_ActivePocket);
     Player.Get().m_BackpackWasOpen = true;
     if (BodyInspectionController.Get().IsActive())
     {
         HintsManager.Get().ShowHint("Inspection_Backpack", 10f);
     }
     this.m_ActivityChanged = true;
 }
示例#24
0
 private bool CanAttack()
 {
     return(!MainLevel.Instance.IsPause() && !this.m_Player.IsDead() && !SwimController.Get().IsActive() && !HUDWheel.Get().enabled&& !BodyInspectionController.Get().IsActive() && !WatchController.Get().IsActive() && !NotepadController.Get().IsActive() && !MapController.Get().IsActive() && this.m_ActionAllowed && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && this.m_CurrentParam != 6 && this.m_CurrentParam != 8);
 }
 private bool CanAttack()
 {
     return(!FightController.s_BlockFight && !MainLevel.Instance.IsPause() && Time.time - MainLevel.Instance.m_LastUnpauseTime >= 0.25f && !this.m_Player.IsDead() && !SwimController.Get().IsActive() && !HUDWheel.Get().enabled&& !BodyInspectionController.Get().IsActive() && !WatchController.Get().IsActive() && !NotepadController.Get().IsActive() && !MapController.Get().IsActive() && this.m_ActionAllowed && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && this.m_CurrentParam != 6 && this.m_CurrentParam != 8 && !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding") && !HUDSelectDialog.Get().enabled);
 }
 private void Awake()
 {
     w  = GetComponent <WatchEvent>();
     wc = FindObjectOfType <WatchController>();
 }
示例#27
0
                /// <summary>
                /// トリックスターのクライアントを監視し、一定時間「応答なし」になった場合に
                /// 強制終了を行うか可否の選択と、終了の処理を行います。
                /// </summary>
                public void watcher()
                {
                    status proc = WatchController.processWatch();

                    if (proc != status.End)
                    {
                        this.gameStats = stats.Start;

                        // 起動中
                        if (this.ProcessStatus != status.Running)
                        {
                            this.ProcessStatus = status.Running;
                            //SimpleLogger.WriteLine("Trickster Client start...");
                        }

                        /*
                         * 1回目の応答なし判定
                         * メモ:1回で応答なしとみなさない理由は、マップ移動やキャラクターデータ
                         * 読み込み時にも一時的に応答なし状態として検出されてしまうため。
                         */
                        if (proc == status.Stop)
                        {
                            // 応答なし検出時
                            SimpleLogger.WriteLine("detected hunged up trickster.");

                            /*
                             * 検出時動作のsleep衝突によるアプリケーション自体のハングアップ回避のため、
                             * 一時的にタイマーを無効化
                             */
                            //timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                            if (this.processStatus == status.Stop)
                            {
                                return;
                            }

                            this.ProcessStatus = status.Stop;
                            SimpleLogger.WriteLine("sleep " + msec + "msec.");
                            System.Threading.Thread.Sleep(msec);   // sleep
                            SimpleLogger.WriteLine("got up.");
                            this.ProcessStatus = status.Running;

                            proc = WatchController.processWatch();
                            if (proc == status.Running)
                            {
                                this.ProcessStatus = status.Running;
                                SimpleLogger.WriteLine("detected to revive.");
                                // 応答回復の場合は修理再開
                                timer.Enabled = true;
                                return;
                            }

                            /*
                             * 検出閾値時間分sleepしても応答がない場合は
                             * 正式に応答なしと判定する
                             */
                            if (proc == status.Stop)
                            {
                                this.ProcessStatus = status.Stop;
                                // 一時的にtimerを無効化
                                timer.Enabled = false;
                                SimpleLogger.WriteLine("Trickster process is hunged up !!");
                                System.Windows.Forms.DialogResult MsgRes = System.Windows.Forms.MessageBox.Show("Trickster の応答なしを検出しました。" + Environment.NewLine + "ゲームを強制終了しますか?", "Trickster Tools", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button2);
                                if (MsgRes == System.Windows.Forms.DialogResult.Yes)
                                {
                                    SimpleLogger.WriteLine("Trickster ProcessID: " + WatchController.TrickProcess.Id);

                                    try
                                    {
                                        WatchController.TrickProcess.Kill();
                                        SimpleLogger.WriteLine("ProcessID: " + WatchController.TrickProcess.Id + " is killed.");
                                        this.ProcessStatus = status.ForceKilled;
                                    }
                                    catch (System.InvalidOperationException ioe)
                                    {
                                        SimpleLogger.WriteLine(ioe.Message);

                                        SimpleLogger.WriteLine("failed to kill " + WatchController.TrickProcess.Id);
                                        System.Windows.Forms.MessageBox.Show("ゲームの終了処理に失敗しました。", "Trickster Tools", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                                    }
                                    catch (System.SystemException se)
                                    {
                                        SimpleLogger.WriteLine(se.Message);
                                        SimpleLogger.WriteLine("failed to kill " + WatchController.TrickProcess.Id);
                                        System.Windows.Forms.MessageBox.Show(se.Message, "Exceptional error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                                        System.Windows.Forms.MessageBox.Show("ゲームの終了処理に失敗しました。", "Trickster Tools", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                                    }
                                }
                                else
                                {
                                    SimpleLogger.WriteLine("ignore hungup");
                                    //this.hungCount = 0;
                                    this.ProcessStatus = status.Running;
                                }

                                timer.Enabled = true;
                            }
                        }
                    }
                    else
                    {
                        // 終了時
                        // 起動した形跡があったらタスクバーの表示を試みる
                        if (this.gameStats == stats.Start && (this.ProcessStatus == status.Running || this.ProcessStatus == status.ForceKilled))
                        {
                            SimpleLogger.WriteLine("try to recover taskbar.");
                            ProgramController.showTaskBar();
                        }
                        this.processStatus = status.End;
                        this.gameStats     = stats.Shutdown;
                    }
                }