private void Search(object sender, RoutedEventArgs e)
        {
            int  id   = Int32.Parse(idText.Text);
            Ride rslt = RideController.SearchByID(id);

            if (rslt != null)
            {
                NameLabel.Content = "Your Status of " + rslt.RideName + "Ride was " + rslt.RideStatus_;
                if (rslt.RideStatus_.Contains("Waiting For Construction"))
                {
                    startConstructionButton.IsEnabled = true;
                    finishConstruct.IsEnabled         = false;
                }
                else if (rslt.RideStatus_.Contains("In Progress"))
                {
                    finishConstruct.IsEnabled = true;
                }
            }
            else
            {
                NameLabel.Content                 = "Not found !";
                finishConstruct.IsEnabled         = false;
                startConstructionButton.IsEnabled = false;
            }
        }
Example #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     //string test = pc == null ? "Null" : "Not Null";
     //MessageBox.Show(test);
     pc = RideController.getInstance();
     refreshTable();
 }
 public void Ride(int rideId)
 {
     if (currentRideid == rideId)
     {
         return;
     }
     currentRideid = rideId;
     if (rideId > 0)
     {
         this.rideController = GammaObjectManager.Instance.LoadRide(rideId, this.transform);
     }
     else
     {
         Destroy(this.rideController.gameObject);
         this.rideController = null;
     }
     if (this.rideController == null)
     {
         this.anim.transform.localPosition = Vector3.zero;
         this.anim.SetLayerWeight(1, 0);
     }
     else
     {
         this.rideController.SetRider(this);
         this.anim.SetLayerWeight(1, 1);
     }
 }
Example #4
0
        public void PostTest()
        {
            RideController rideController = new RideController(_mockRideService.Object);
            RideViewModel  rideViewModel  = new RideViewModel();
            var            result         = rideController.Post(rideViewModel);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.TotalPrice, 5);
        }
Example #5
0
 public RideControllerTests()
 {
     unit                = GetUnifOfWork();
     logger              = new Mock <ILogger <RideController> >();
     temp                = new Mock <ITempDataDictionary>();
     helper              = new Mock <IHelper>();
     controller          = new RideController(unit.Object, logger.Object, helper.Object);
     controller.TempData = temp.Object;
 }
Example #6
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     rc                  = RideController.getInstance();
     id.Content          = r.ActivityID + "";
     status.Text         = r.Status;
     type.Content        = r.ActivityType;
     nameBox.Text        = r.ActivityName;
     durationBox.Text    = r.ActivityDuration + "";
     descriptionBox.Text = r.ActivityDescription;
     heightBox.Text      = r.MinHeight + "";
     AgeBox.Text         = r.MinAge + "";
     RestrictionBox.Text = r.Restriction;
 }
Example #7
0
        public void RideControllerDeleteConfirmedReturnsView_ExpectedSuccess()
        {
            // Arrange
            var _mock = new Mock <IRideLogic>();

            _mock.Setup(x => x.GetSingleRide(It.IsAny <Int32>())).ReturnsAsync(GetRide());
            var controllerUnderTest = new RideController(_context, _mock.Object);

            // Act
            var result = controllerUnderTest.DeleteConfirmed(1);

            // Assert
            var viewResult = Assert.IsType <Task <IActionResult> >(result);
        }
        private void searchRide(object sender, RoutedEventArgs e)
        {
            int  id   = Int32.Parse(idText.Text);
            Ride rslt = RideController.SearchByID(id);

            if (rslt != null)
            {
                rideNameText.Text              = rslt.RideName;
                rideDescriptionText.Text       = rslt.RideDescription;
                rideHowToWorkText.Text         = rslt.RideHowToWork;
                rideSafetyInformationText.Text = rslt.RideSafetyInformation;
                rideType.Text = rslt.RideType;
            }
        }
Example #9
0
        public void RideControllerCreateReturnsView_ExpectedSuccess()
        {
            // Arrange
            var rides = GetRides();
            var _mock = new Mock <IRideLogic>();

            _mock.Setup(x => x.GetDriverRides(It.IsAny <Int32>())).ReturnsAsync(rides);
            var controllerUnderTest = new RideController(_context, _mock.Object);

            // Act
            var result = controllerUnderTest.Create(GetRide());

            // Assert
            var viewResult = Assert.IsType <Task <IActionResult> >(result);
        }
Example #10
0
        public void RideControllerPassengerIndexReturnsView_ExpectedSuccess()
        {
            // Arrange
            var rides = GetRides();
            var _mock = new Mock <IRideLogic>();

            _mock.Setup(x => x.GetPassengerRides(It.IsAny <Int32>())).ReturnsAsync(rides);
            var controllerUnderTest = new RideController(_context, _mock.Object);

            // Act
            var result = controllerUnderTest.PassengerIndex(1);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(typeof(Task <IActionResult>), result.GetType());
        }
        private void StartConstructionButton_Click(object sender, RoutedEventArgs e)
        {
            int  id   = Int32.Parse(idText.Text);
            Ride rslt = RideController.SearchByID(id);

            if (rslt.RideStatus_.Contains("Waiting For Construction To Delete"))
            {
                RideController.ProgressDelete(rslt);
            }
            else if (rslt.RideStatus_.Contains("Waiting For Construction To Add"))
            {
                RideController.ProgressAdd(rslt);
            }
            else if (rslt.RideStatus_.Contains("Waiting For Construction To Update"))
            {
                RideController.ProgressUpdate(rslt);
            }
            refreshTable();
        }
        public void GetAllRidess_ShouldReturnAllRides()
        {
            // Arrange
            var mockRideService = new Mock <IRideService>();

            mockRideService.Setup(x => x.GetAllRides())
            .Returns(GetTestRides());

            var controller = new RideController(mockRideService.Object);



            // Act
            var contentResult = controller.GetAllRides();

            // Assert
            Assert.NotNull(contentResult);
            Assert.Equal(GetTestRides().Count, contentResult.Count);
        }
        public async void GetRideMetrics_Should_Return_Not_Found_Result_If_Data_Not_Found()
        {
            var mediatorMock = new Mock <IMediator>();
            var loggerMock   = new Mock <ILogger>();

            mediatorMock
            .Setup(x => x.Send(It.IsAny <GetRideMetricsByPeriodSelectionQuery>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new QueryResult <RideMetrics>()
            {
                Type = QueryResultTypeEnum.NotFound
            });
            var controller = new RideController(
                loggerMock.Object,
                mediatorMock.Object
                );

            var response = await controller.GetRideMetrics(PeriodSelectionEnum.AllTime);

            Assert.IsType <NotFoundResult>(response.Result);
        }
        public async void SaveRide_Should_Return_Bad_Result_If_Invalid_Input()
        {
            var mediatorMock = new Mock <IMediator>();
            var loggerMock   = new Mock <ILogger>();

            mediatorMock
            .Setup(x => x.Send(It.IsAny <CreateRideCommand>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new CommandResult <bool>()
            {
                Type = CommandResultTypeEnum.InvalidInput
            });
            var controller = new RideController(
                loggerMock.Object,
                mediatorMock.Object
                );

            var response = await controller.SaveRide(new Ride());

            Assert.IsType <BadRequestResult>(response.Result);
        }
        private void FinishConstruct_Click(object sender, RoutedEventArgs e)
        {
            int  id   = Int32.Parse(idText.Text);
            Ride rslt = RideController.SearchByID(id);

            if (rslt.RideStatus_.Contains("In Progress To Delete"))
            {
                RideController.FinishDeleteRide(rslt);
            }
            else if (rslt.RideStatus_.Contains("In Progress To Add"))
            {
                RideController.FinishAddRide(rslt);
            }
            else if (rslt.RideStatus_.Contains("In Progress To Update"))
            {
                RideController.FinishUpdateRide(rslt);
            }

            refreshTable();
        }
        public async void SaveRide_Should_Return_Ok_Result()
        {
            var mediatorMock = new Mock <IMediator>();
            var loggerMock   = new Mock <ILogger>();

            mediatorMock
            .Setup(x => x.Send(It.IsAny <CreateRideCommand>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new CommandResult <bool>()
            {
                Type = CommandResultTypeEnum.Success
            });
            var controller = new RideController(
                loggerMock.Object,
                mediatorMock.Object
                );

            var response = await controller.SaveRide(new Ride());

            Assert.IsType <OkObjectResult>(response.Result);
            mediatorMock.Verify(x => x.Send(It.IsAny <CreateRideCommand>(), It.IsAny <CancellationToken>()), Times.Once());
        }
        public async void GetRideMetrics_Should_Return_Ok_Result()
        {
            var mediatorMock = new Mock <IMediator>();
            var loggerMock   = new Mock <ILogger>();

            mediatorMock
            .Setup(x => x.Send(It.IsAny <GetRideMetricsByPeriodSelectionQuery>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new QueryResult <RideMetrics>()
            {
                Type = QueryResultTypeEnum.Success
            });
            var controller = new RideController(
                loggerMock.Object,
                mediatorMock.Object
                );

            var response = await controller.GetRideMetrics(PeriodSelectionEnum.AllTime);

            Assert.IsType <OkObjectResult>(response.Result);
            mediatorMock.Verify(x => x.Send(It.IsAny <GetRideMetricsByPeriodSelectionQuery>(), It.IsAny <CancellationToken>()), Times.Once());
        }
        public void GetReturnsRideWithSameId()
        {
            string guid = "80b8aa6b-4dde-4df5-9a40-60d2cd4d0e04";
            // Arrange
            var mockRideService = new Mock <IRideService>();

            mockRideService.Setup(x => x.GetRideByID(Guid.Parse(guid)))
            .Returns(new Ride {
                ID = Guid.Parse(guid)
            });

            var controller = new RideController(mockRideService.Object);

            // Act
            var contentResult = controller.GetRideByID(Guid.Parse(guid));


            // Assert
            Assert.NotNull(contentResult);
            Assert.Equal(Guid.Parse(guid), contentResult.ID);
        }
Example #19
0
        public void RideControllerEditReturnsView_ExpectedSuccess()
        {
            // Arrange
            Ride ride = new Ride
            {
                RideId       = 2,
                PostId       = 2,
                RideStatusId = 2,
                RequestId    = 2
            };

            var _mock = new Mock <IRideLogic>();

            _mock.Setup(x => x.GetSingleRide(It.IsAny <Int32>())).ReturnsAsync(GetRide());
            var controllerUnderTest = new RideController(_context, _mock.Object);

            // Act
            var result = controllerUnderTest.Edit(1, ride);

            // Assert
            var viewResult = Assert.IsType <Task <IActionResult> >(result);
        }
Example #20
0
        private void ExecuteButton_Click(object sender, RoutedEventArgs e)
        {
            int id = Int32.Parse(idText.Text);

            if (RideRadioButton.IsChecked == true)
            {
                if (RequestRideController.SearchByID(id).RideStatus_.Equals("Accepted For Adding"))
                {
                    RideController.CreateRide(RequestRideController.SearchByID(id));
                }
                else if (RequestRideController.SearchByID(id).RideStatus_.Equals("Accepted For Updating"))
                {
                    RideController.UpdateRide(RequestRideController.SearchByID(id));
                }
                else
                {
                    RideController.deleteRide(RequestRideController.SearchByID(id));
                }
                RequestRideController.FinishRequestRide(id);
            }
            else
            {
                if (RequestAttractionController.SearchByID(id).AttractionStatus.Equals("Accepted For Adding"))
                {
                    AttractionController.CreateRide(RequestAttractionController.SearchByID(id));
                }
                else if (RequestAttractionController.SearchByID(id).AttractionStatus.Equals("Accepted For Updating"))
                {
                    AttractionController.UpdateAttraction(RequestAttractionController.SearchByID(id));
                }
                else
                {
                    AttractionController.deleteAttraction(RequestAttractionController.SearchByID(id));
                }

                RequestAttractionController.FinishRequestAttraction(id);
            }
        }
        private static void OnSceneLoaded(ScenarioModule.Arg arg)
        {
            Module <ScenarioModule> .Self.EndLoadEventor -= OnSceneLoaded;
            if (!isLoading)
            {
                return;
            }

            Module <Player> .Self.GamePos = VectorFromString(lastLoadedSave.position);

            Dbgl("input solution: " + Module <InputSolutionModule> .Self.CurSolutionType + "");
            Module <InputSolutionModule> .Self.Pop();

            Module <InputSolutionModule> .Self.Push(SolutionType.Gaming);


            //Module<SleepModule>.Self.GetType().GetMethod("PlayerWakeUpAfterArchive", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Module<SleepModule>.Self, new object[] { });

            //Module<SleepModule>.Self.GetType().GetMethod("ShowSleepMask", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Module<SleepModule>.Self, new object[] { false });
            //MessageManager.Instance.Dispatch("WakeUpScreen", null, DispatchType.IMME, 2f);

            //Module<SleepModule>.Self.WakeUpScreenMaskFinishedEvent?.Invoke();

            Singleton <SleepTipMgr> .Self.SleepState(false);

            Dbgl("Checking DLC");

            // stuff that needs to be recreated after save

            GameDLCRewardsModule.Self.GetType().GetMethod("CheckAndOpenAllDlc", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Module <GameDLCRewardsModule> .Self, new object[] { });

            Dbgl("Checking Engagement");

            if (Module <EGMgr> .Self.IsEngagement())
            {
                Dbgl("Engagement is active");
                EGDate       date      = AccessTools.FieldRefAccess <EGMgr, EGDate>(Module <EGMgr> .Self, "mDate");
                GameDateTime dateBegin = AccessTools.FieldRefAccess <EGDate, GameDateTime>(date, "mBeginTimer");
                if (Module <TimeManager> .Self.DateTime > dateBegin)
                {
                    date.GetType().GetMethod("InitProjectMap", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(date, new object[] { });
                    Actor mActor = AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor");
                    AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor").SetBehaviorValue("EGActor", Module <Player> .Self.actor);
                    AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor").SetBehaviorValue("EGDate", EGData.GetDatePlace(AccessTools.FieldRefAccess <EGDate, int>(date, "mDateID")));
                    AccessTools.FieldRefAccess <EGDate, SharedInt>(date, "mForceValue")     = mActor.GetBehaviorVariable <SharedInt>("EGForce");
                    AccessTools.FieldRefAccess <EGDate, SharedInt>(date, "mMoodValue")      = mActor.GetBehaviorVariable <SharedInt>("EGMood");
                    AccessTools.FieldRefAccess <EGDate, SharedIntList>(date, "mEventCount") = mActor.GetBehaviorVariable <SharedIntList>("EGEventIDs");
                    AccessTools.FieldRefAccess <EGDate, List <EGRoot> >(date, "mRoots")     = mActor.behavior.FindTasks <EGRoot>();
                    date.Start();
                    Dbgl("Engagement starts with " + mActor.ActorName);
                }
                else if (Module <TimeManager> .Self.DateTime > dateBegin - EGConst.Spawn_Hour_1)
                {
                    Dbgl("Less than one hour before engagement starts!");
                    date.GetType().GetMethod("InitProjectMap", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(date, new object[] { });
                    Actor mActor = AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor");
                    AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor").SetBehaviorValue("EGActor", Module <Player> .Self.actor);
                    AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor").SetBehaviorValue("EGDate", EGData.GetDatePlace(AccessTools.FieldRefAccess <EGDate, int>(date, "mDateID")));
                    AccessTools.FieldRefAccess <EGDate, SharedInt>(date, "mForceValue")     = mActor.GetBehaviorVariable <SharedInt>("EGForce");
                    AccessTools.FieldRefAccess <EGDate, SharedInt>(date, "mMoodValue")      = mActor.GetBehaviorVariable <SharedInt>("EGMood");
                    AccessTools.FieldRefAccess <EGDate, SharedIntList>(date, "mEventCount") = mActor.GetBehaviorVariable <SharedIntList>("EGEventIDs");
                    AccessTools.FieldRefAccess <EGDate, List <EGRoot> >(date, "mRoots")     = mActor.behavior.FindTasks <EGRoot>();
                    Singleton <TipsMgr> .Instance.SendSystemTip(string.Format(TextMgr.GetStr(100507, -1), TextMgr.GetStr(AccessTools.FieldRefAccess <EGDate, int>(date, "mTipTypeID"), -1)), SystemTipType.warning);
                }
                else if (Module <TimeManager> .Self.DateTime > dateBegin - EGConst.Spawn_Hour_2)
                {
                    Dbgl("Less than two hours hour before engagement starts!");
                    date.GetType().GetMethod("InitProjectMap", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(date, new object[] { });
                    Actor mActor = AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor");
                    AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor").SetBehaviorValue("EGActor", Module <Player> .Self.actor);
                    AccessTools.FieldRefAccess <EGDate, Actor>(date, "mActor").SetBehaviorValue("EGDate", EGData.GetDatePlace(AccessTools.FieldRefAccess <EGDate, int>(date, "mDateID")));
                    AccessTools.FieldRefAccess <EGDate, SharedInt>(date, "mForceValue")     = mActor.GetBehaviorVariable <SharedInt>("EGForce");
                    AccessTools.FieldRefAccess <EGDate, SharedInt>(date, "mMoodValue")      = mActor.GetBehaviorVariable <SharedInt>("EGMood");
                    AccessTools.FieldRefAccess <EGDate, SharedIntList>(date, "mEventCount") = mActor.GetBehaviorVariable <SharedIntList>("EGEventIDs");
                    AccessTools.FieldRefAccess <EGDate, List <EGRoot> >(date, "mRoots")     = mActor.behavior.FindTasks <EGRoot>();
                    Singleton <TipsMgr> .Instance.SendSystemTip(string.Format(TextMgr.GetStr(100506, -1), TextMgr.GetStr(AccessTools.FieldRefAccess <EGDate, int>(date, "mTipTypeID"), -1)), SystemTipType.warning);
                }
            }

            if (arg.IsMain)
            {
                Dbgl("Checking Ridables");
                Module <FarmModule> .Self.ForeachUnit(delegate(Unit unit, bool isFloor)
                {
                    if (unit != null && unit is RidableTamingUnit)
                    {
                        RidableTamingUnit ru            = unit as RidableTamingUnit;
                        GameObject unitGameObjectByUnit = Module <FarmModule> .Self.GetUnitGameObjectByUnit(unit);
                        if (unitGameObjectByUnit == null)
                        {
                            return;
                        }
                        RidableTamingUnitViewer uv = (RidableTamingUnitViewer)unitGameObjectByUnit.GetComponentInChildren <UnitViewer>();

                        AccessTools.FieldRefAccess <RidableTamingUnitViewer, List <IRidable> >(uv, "ridableList").Clear();

                        typeof(RidableTamingUnitViewer).GetMethod("CreateShit", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(uv, new object[] { });
                        typeof(RidableTamingUnitViewer).GetMethod("CreateAllWorkableRidable", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(uv as RidableTamingUnitViewer, new object[] { });
                        typeof(RidableTamingUnitViewer).GetMethod("UpdateAllRidableInfo", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(uv as RidableTamingUnitViewer, new object[] { });
                    }
                });

                typeof(RidableModuleManager).GetMethod("InitIdGenerator", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(Module <RidableModuleManager> .Self, new object[] { });

                Dictionary <int, RidableTransactionSaveData> rideDic = AccessTools.FieldRefAccess <RidableModuleManager, Dictionary <int, RidableTransactionSaveData> >(Module <RidableModuleManager> .Self, "ridableTransactionDataDic");
                int[] rideKeys = new int[rideDic.Count];
                rideDic.Keys.CopyTo(rideKeys, 0);
                foreach (int key in rideKeys)
                {
                    if (rideDic[key].RidableSource == RidableSource.NPC)
                    {
                        AccessTools.FieldRefAccess <RidableModuleManager, Dictionary <int, RidableTransactionSaveData> >(Module <RidableModuleManager> .Self, "ridableTransactionDataDic").Remove(key);
                    }
                }

                Scene sceneByName = SceneManager.GetSceneByName(arg.scenarioName);
                if (sceneByName.IsValid() && sceneByName.isLoaded)
                {
                    GameObject[] gos = sceneByName.GetRootGameObjects();
                    foreach (GameObject go in gos)
                    {
                        Component co = go.GetComponentInChildren(typeof(NpcsRidableManager));
                        if (co != null)
                        {
                            Dbgl("Got NpcsRidableManager");
                            (co as NpcsRidableManager).DestoryAllRidable();
                            AccessTools.FieldRefAccess <RidableFences, Dictionary <IRidable, RidableFence> >((co as NpcsRidableManager), "ridableDic").Clear();
                            typeof(NpcsRidableManager).GetMethod("AfterPlayerWakeUpEvent", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(co as NpcsRidableManager, new object[] { });
                        }
                    }
                }
            }

            Dbgl("Checking wishes");
            AccessTools.FieldRefAccess <DynamicWishManager, List <int> >(Module <DynamicWishManager> .Self, "hasTalkToday").AddRange(from it in AccessTools.FieldRefAccess <DynamicWishManager, List <DoubleInt> >(Module <DynamicWishManager> .Self, "curWishData") select it.id0);

            //Module<RidableModuleManager>.Self.InitNpcRidableBehaviourValue();

            // stuff that needs to be carried over but isnt, use meta file

            Dbgl("Loading Meta");
            string filePath = Path.Combine(GetSavesPath(), $"{lastLoadedSave.fileName}.xml");

            try
            {
                System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(SaveMeta));
                StreamReader file = new StreamReader($"{filePath}");
                SaveMeta     save = (SaveMeta)reader.Deserialize(file);
                file.Close();

                Dbgl("Loading Player Meta");

                if (save.playerRot != null)
                {
                    string[]   rotStrings = save.playerRot.Replace("(", "").Replace(")", "").Replace(" ", "").Split(',');
                    Quaternion rot        = new Quaternion(float.Parse(rotStrings[0]), float.Parse(rotStrings[1]), float.Parse(rotStrings[2]), float.Parse(rotStrings[3]));
                    Player.Self.GameRot = rot;
                }

                Dbgl("Loading NPC Meta");

                foreach (NPCMeta npc in save.NPClist)
                {
                    Actor actor = Module <ActorMgr> .Self.Get(npc.id);

                    if (actor != null)
                    {
                        Module <ActorMgr> .Self.MoveToScenario(actor, npc.scene, VectorFromString(npc.pos));
                    }
                }

                Dbgl("Loading Ridable Meta");

                if (save.RideableList != null)
                {
                    foreach (RideableMeta r in save.RideableList)
                    {
                        IRidable rideable = Module <RidableModuleManager> .Self.GetRidable(r.id);

                        if (rideable == null)
                        {
                            Dbgl("null rideable " + r.id);

                            rideable = Module <RidableModuleManager> .Self.GetRidable(r.id);

                            continue;
                        }
                        Dbgl("got rideable " + r.id);
                        Actor actor = rideable.GetActor();
                        if (actor != null)
                        {
                            Dbgl("got rideable actor for " + rideable.GetNickName());
                            actor.gamePos = VectorFromString(r.pos);
                            actor.RefreshPos();
                        }
                        switch (r.state)
                        {
                        case "None":
                            rideable.SetRidableState(RidableState.None);
                            break;

                        case "Idle":
                            rideable.SetRidableState(RidableState.Idle);
                            break;

                        case "Ride":
                            if (rideable.BelongToPlayer)
                            {
                                int otherNPCID = Module <EGMgr> .Self.GetEngagementStartNpcID();

                                if (RideUtils.TestRideWithNpcID > 0)
                                {
                                    otherNPCID = RideUtils.TestRideWithNpcID;
                                    RideUtils.TestRideWithNpcID = -1;
                                }
                                Module <Player> .Self.RideRidable(rideable, otherNPCID);
                            }
                            else if (rideable.GetBelongRider() is ActorRiderAdapter)
                            {
                                Actor          belongActor    = (rideable.GetBelongRider() as ActorRiderAdapter).actor;
                                RideController rideController = belongActor.RideController;
                                rideController.RideOn(rideable);
                            }
                            break;

                        case "Follow":
                            rideable.SetRidableState(RidableState.Follow);
                            break;

                        case "Stay":
                            rideable.SetRidableState(RidableState.Stay);
                            break;
                        }
                    }
                }

                Dbgl("Loading Fishbowl Meta");

                if (save.FishBowlConsumeHour != -1)
                {
                    typeof(FishBowl).GetField("consumeHour", BindingFlags.NonPublic | BindingFlags.Static).SetValue(Module <FishBowl> .Self, save.FishBowlConsumeHour);
                }

                Dbgl("Loading Store Meta");

                AccessTools.FieldRefAccess <StoreManagerV40, float>(Module <StoreManagerV40> .Self, "curPriceIndex") = save.CurPriceIndex;

                if (save.StoreList != null)
                {
                    foreach (StoreMeta sMeta in save.StoreList)
                    {
                        Module <StoreManagerV40> .Self.GetStore(sMeta.id).recycleCount = sMeta.recycleCount;

                        Module <StoreManagerV40> .Self.GetStore(sMeta.id).ownMoney = sMeta.money;
                    }
                }

                Dbgl("Loading Weather Meta");

                if (save.WeatherState != -1)
                {
                    AccessTools.FieldRefAccess <WeatherModule, WeatherCtr>(Module <WeatherModule> .Self, "weatherCtr").SetWeather((WeatherState)save.WeatherState);
                }
            }
            catch (Exception ex)
            {
                Dbgl("Problem with meta file: " + ex);
            }
            isLoading = false;
            resetLastSave();
        }
Example #22
0
        public void ConstructorTest()
        {
            RideController rideController = new RideController(_mockRideService.Object);

            Assert.IsNotNull(rideController);
        }
Example #23
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     rc         = RideController.getInstance();
     id.Content = (rc.getLastIndex() + 1) + "";
 }