// Use this for initialization void Start() { GameObject CLI = GameObject.Find ("CompetitionLawInfringeMent"); storyController = CLI.GetComponent<StoryController> (); GameObject player = GameObject.FindGameObjectWithTag ("Player"); playerController = player.GetComponent<PlayerController> (); wannaExit = false; coolingDown = false; }
public void DeleteStoryTest() { //Arrange var mock = new Mock <IStoryService>(); var mockSprint = new Mock <ISprintService>(); SprintDTO sprintDTO = new SprintDTO(); mockSprint.Setup(a => a.Create(sprintDTO)); StoryDTO storyDTO = new StoryDTO { Name = "Test", Description = "Description" }; mock.Setup(a => a.CreateStory(storyDTO)); StoryController controller = new StoryController(mock.Object, mockSprint.Object); var temp = controller.CreateStory(storyDTO); //Act var result = controller.DeleteStory(storyDTO.Story_id); //Assert Assert.IsType <OkResult>(result); }
public static void Save(bool ToFile = true) { GameObject player = GameObject.FindGameObjectWithTag("Player"); SaveData saveData = new SaveData { PositionX = player.transform.position.x, PositionY = player.transform.position.y, PositionZ = player.transform.position.z, ScrollsCaughtCount = StoryController.GetNumberScrollsFound(), CurrHealth = Battle.playerEntity.CurrentHealth, CurrExp = Battle.playerEntity.CurrentExperience, CurrLevel = Battle.playerEntity.Stats.Level, FountainsUsed = FountainsUsedList.ToArray(), EnemiesDefeated = EnemiesDefeatedList.ToArray(), ScrollsCaught = ScrollsCaughtList.ToArray(), VinesDestroyed = VinesDestroyedStatic }; if (!ToFile) { data = saveData; return; } BinaryFormatter binaryFormatter = new BinaryFormatter(); if (File.Exists(Application.persistentDataPath + "/playerInfo.dat")) { File.Delete(Application.persistentDataPath + "/playerInfo.dat"); } FileStream fileStream = File.Create(Application.persistentDataPath + "/playerInfo.dat"); Debug.Log("Game Saved On: " + Application.persistentDataPath + "/playerInfo.dat"); binaryFormatter.Serialize(fileStream, saveData); fileStream.Close(); }
public void Interact() { GameObject controller = GameObject.Find("ControllerManager"); if (controller == null) { return; } StoryController storyController = controller.GetComponent <StoryController> (); if (storyController == null) { return; } //bool result = storyController.LoadStoryByItem (m_objectName); UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = m_objectName }); }
public async Task CanGetStories(int count, IEnumerable <HackerNewsItem> items) { // Arrange var newsService = new Mock <IStoryService>(); newsService.Setup(x => x.GetStories(It.IsAny <int>())).ReturnsAsync(items); var controller = new StoryController(newsService.Object); // Act var response = await controller.GetStories(count); // Assert Assert.IsNotNull(response); Assert.IsInstanceOfType(response, typeof(OkObjectResult)); var responseObject = (response as ObjectResult).Value; Assert.IsInstanceOfType(responseObject, typeof(StoryResponseModel)); Assert.IsNotNull((responseObject as StoryResponseModel).Stories); Assert.AreEqual((responseObject as StoryResponseModel).Stories.Count(), (responseObject as StoryResponseModel).Count); }
// Use this for initialization IEnumerator Start() { storyController = GameObject.FindWithTag("storyController").GetComponent <StoryController> (); storyController.newestRoomStoryUnread = 2; yield return(new WaitForSeconds(5)); TriggerRoomGeneration[] doors = gameObject.GetComponentsInChildren <TriggerRoomGeneration> (); foreach (var door in doors) // finding the first door withour connection { if (!door.GetComponent <TriggerRoomGeneration> ().hasBeenConnected) { print("found story controller door hook " + door.direction); door.setColor(Color.yellow); door.otherDoor.setColor(Color.yellow); door.hasBeenConnected = true; door.otherDoor.hasBeenConnected = true; doorHook = door; break; } } }
public void VoteMayCauseGameConsensus() { const int points = 0, projectId = 123, storyId = 456; var gameRepositoryMock = new Mock <IGameRepository>(); var gameStarterMock = new Mock <IGameStarter>(); gameStarterMock.Setup(o => o.Name).Returns("Rumples"); var returnedScore = -1; var game = new Game(); game.Consensus += score => returnedScore = score; var james = new Player { Name = "James" }; game.AddPlayer(james); game.Play(new Card { Player = james, Points = points }); var rumples = new Player { Name = "Rumples" }; game.AddPlayer(rumples); gameRepositoryMock.Setup(g => g.Get(projectId, storyId)).Returns(game); var c = new StoryController(null, gameRepositoryMock.Object, gameStarterMock.Object); c.Vote(projectId, storyId, points); Assert.That(returnedScore, Is.EqualTo(points)); }
public void ThenReturnTheStoryViewModel() { // Arrange _storyRepository.Setup(e => e.GetAll(1)).Returns(_stories.AsQueryable()); _storyRepository.Setup(e => e.GetAllByUserId(It.IsAny <string>(), It.IsAny <int>())).Returns(_stories.Where(x => x.UserId == "UserId1").AsQueryable()); _storyRepository.Setup(e => e.GetItemCountByUserId(It.IsAny <string>())); _groupRepository.Setup(e => e.GetAll()).Returns(_groups.AsQueryable()); var controller = new StoryController(_storyRepository.Object, _groupRepository.Object) { GetUserId = () => "UserId1", GetPageCountByItemCount = (x) => 2 }; // Act var actionResultTask = controller.Index(); actionResultTask.Wait(); var result = actionResultTask.Result as ViewResult; var model = result.Model as StoryViewModel; // Assert Assert.IsNotNull(result); Assert.AreEqual(2, model.UserStories.Count()); }
public void UpdateStoryTest() { var mock = new Mock <IStoryService>(); var mockSprint = new Mock <ISprintService>(); SprintDTO sprintDTO = new SprintDTO(); mockSprint.Setup(a => a.Create(sprintDTO)); StoryDTO storyDTO = new StoryDTO { Name = "Test", Description = "Test" }; mock.Setup(a => a.CreateStory(storyDTO)); string exp = "111"; storyDTO.Name = exp; storyDTO.Description = exp; mock.Setup(a => a.UpdateStory(storyDTO)); StoryController controller = new StoryController(mock.Object, mockSprint.Object); var result = controller.UpdateStory(storyDTO); Assert.IsType <OkResult>(result); Assert.Equal(exp, storyDTO.Name); Assert.Equal(exp, storyDTO.Description); }
private void OnTriggerEnter(Collider other) { if (WeaponsController.hasKnife || WeaponsController.hasGun || WeaponsController.hasDoubleGun) { if (StoryController.CanLeaveScene()) { storyController.GoToNextScene(); InputManager.moveForward = false; InputManager.moveBackwards = false; InputManager.rotateCCW = false; InputManager.rotateCW = false; InputManager.fire = false; } else { infoText.SetActive(true); infoText.GetComponent <Text> ().text = "Can't leave yet. Talk to " + StoryController.GetTriggerNPCName(); infoText.GetComponent <Text> ().color = Color.red; } } else { infoText.SetActive(true); infoText.GetComponent <Text> ().text = "Don't leave Town without a weapon!"; infoText.GetComponent <Text> ().color = Color.red; } }
public StoryControllerTest() { repo = Mock.Create <IStoryRepository>(); service = Mock.Create <IStoryReadService>(); target = new StoryController(service, repo); }
public void SetUp() { _httpClientFactory = new Mock <IHttpClientFactory>(); _storyService = new Mock <IStoryService>(_httpClientFactory.Object); _controller = new StoryController(_storyService.Object); }
protected override void Callback() { GameObject controller = GameObject.Find("ControllerManager"); if (controller == null) { return; } StoryController storyController = controller.GetComponent <StoryController> (); if (storyController == null) { return; } if (m_newStoryFileName == "") { Debug.LogWarning("New Story File Name is empty"); } else { storyController.LoadStoryFileByName(m_newStoryFileName); } if (m_showStoryPanel) { CheckJumpLabel(); if (!m_onlyTiriggerOnce && !m_jumpToLabel.Contains("_")) { //Need auto generate story string jumpLabel = m_jumpToLabel + "_" + m_triggerCounter; if (storyController.IsLabelExist(jumpLabel)) { UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = jumpLabel }); m_triggerCounter++; } else { m_triggerCounter = --m_triggerCounter < 0 ? 0 : m_triggerCounter; jumpLabel = m_jumpToLabel + "_" + m_triggerCounter; UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = jumpLabel }); } } else { UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = m_jumpToLabel }); } } if (m_onlyTiriggerOnce) { SingletonGlobalDataContainer.Instance.AddtTriggeredStory(m_jumpToLabel); Destroy(gameObject); } else { CoreContainer.Instance.SetPlayerPosition(transform.position + WorldTriggerCallbackTeleportPlayer.DirecitonMapping[m_spawnDirection] * m_lengthBetweenTriggerAndSpwanPoint + new Vector3(0.0f, 0.5f, 0.0f)); } }
void Start() { singleton = this; StartCoroutine(loadCurNode()); }
public void Setup() { storyController = new StoryController(new StoryRepository()); }
private void Start() { usedHateConversations = new bool[6]; story = GameObject.FindGameObjectWithTag("Story").GetComponent <StoryController>(); }
public void Interact() { GameObject controller = GameObject.Find("ControllerManager"); if (controller == null) { return; } StoryController storyController = controller.GetComponent <StoryController> (); if (storyController == null) { return; } if (m_objectName == null || m_objectName == "") { return; } //bool result = storyController.LoadStoryByItem (m_objectName); if (!m_objectName.Contains("_")) { int outCounterValue = -1; bool result = SingletonGlobalDataContainer.Instance.GetObjectCounter(m_objectName, out outCounterValue); if (result == false) { return; } if (outCounterValue == -1) { return; } string jumpLabel = m_objectName + "_" + outCounterValue; if (storyController.IsLabelExist(jumpLabel)) { UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = jumpLabel }); SingletonGlobalDataContainer.Instance.ModifyCounterValue(m_objectName, 1); } else { SingletonGlobalDataContainer.Instance.ModifyCounterValue(m_objectName, -1); SingletonGlobalDataContainer.Instance.GetObjectCounter(m_objectName, out outCounterValue); jumpLabel = m_objectName + "_" + outCounterValue; UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = jumpLabel }); } } else { UI.UIManager.Instance().ShowStaticPanel(UIPanelType.TalkPanel, new TalkDataProvider() { ID = m_objectName }); } }
public StoryManager(string referencePath) { storyController = Services.Get <ResourcesManager>().Spawn(referencePath).GetComponent <StoryController>(); }
// Use this for initialization void Awake(){ instance = this; }
// Update is called once per frame void Start() { //access story controller ssControl = FindObjectOfType <StoryController>(); }
void Start() { stress_score = this.GetComponent <Text>(); stress_score.text = StoryController.getStress().ToString(); }
void Update() { stress_score.text = StoryController.getStress().ToString(); }
public StoryController storyControl; //Annie // Start is called before the first frame update void Start() { storyControl = GameObject.FindWithTag("StoryControl").GetComponent <StoryController>(); //Annie maxActions = 11 - GetComponent <PlayerInteraction>().humanCount; actionCount = maxActions; }
public EventController([NotNull] StoryController storyController) { StoryController = storyController; Story = new StoryEvents(this); Game = new GameEvents(this); }
// Start is called before the first frame update void Start() { story = GameObject.FindGameObjectWithTag("Story").GetComponent <StoryController>(); }
//여기까지 IEnumerator StringParser(int currentInt, string levelStr, string dialogs, System.Action <bool, int> callback) { char[] splitter = { '#' }; string[] levelRows = levelStr.Split(splitter); string[] dialogRows = dialogs.Split(splitter); int nextStage = 999; IEnumerable <string> dialogRowsEnum = dialogRows.Cast <string>(); IEnumerable <string[]> dialogRowArrays = dialogRowsEnum.Select(row => row.Split(',')); string[][] dialogRowsDual = dialogRowArrays.ToArray <string[]>(); Dictionary <string, int> dialogBook = new Dictionary <string, int>(); for (int i = 0; i < dialogRowsDual.Length; i++) { string[] row = dialogRowsDual[i]; if (row.Length == 1) { continue; } if (!"".Equals(row[0])) { dialogBook.Add(row[0], i); } else if ("event".Equals(row[1]) && "route".Equals(row[2])) { dialogBook.Add(row[3], i); } else if (row[1].Contains("select") && "end".Equals(row[2])) { dialogBook.Add(row[1], i); } } IEnumerable <string> levelRowsEnum = levelRows.Cast <string>(); IEnumerable <string[]> levelRowArrays = levelRowsEnum.Select(row => row.Split(',')); string[][] levelRowsDual = levelRowArrays.ToArray <string[]>(); //levelRows for (int j = levelRowsDual.Length - 1; j > -1; j--) { string[] fd = levelRowsDual[j]; if (fd[0].Equals("")) { fd[0] = "1"; } float duration = float.Parse(fd[0]); //yield return new WaitForSeconds(duration + 2); yield return(new WaitForSeconds(duration)); for (int i = fd.Length - 1; i > 0; i -= 2) { if (fd[i - 1].Equals("")) { continue; } if (fd[1].Contains("load")) { if (skipDialog) { continue; } string[] loadRow = fd[1].Split('='); string dialogId = loadRow[1]; Debug.Log(dialogId); int index = dialogBook[dialogId]; while (true) { string[] row = dialogRowsDual[index]; Debug.Log(row[1]); if ("event".Equals(row[1])) { if (row[2].Contains("end")) { //대화끝 UI.SetActive(false); DataController.Instance.gameData.storyProgress[currentInt] = 1; StoryController.DoStorySet(); break; } else if (row[2].Contains("show")) { //표시하기 string[] showParam = row[2].Split(' '); string fileName = showParam[1]; string position = row[3]; //getFile // Debug.Log("Position : " + position); //Resources.Load<Sprite>("Assets/Resources/" + fileName); //setFileToPositoin Transform leftTf = UI.transform.Find("Portrait").Find("Left"); Transform rightTf = UI.transform.Find("Portrait").Find("Right"); Image left = leftTf.GetComponent <Image>(); Image right = rightTf.GetComponent <Image>(); if ("left".Equals(position)) { leftTf.SetAsFirstSibling(); left.sprite = Resources.Load <Sprite>("Image/" + fileName) as Sprite; left.color = new Color(255f, 255f, 255, 1f); if (right.sprite != null) { right.color = new Color(100f, 100f, 100, 0.7f); } } else { rightTf.SetAsFirstSibling(); right.sprite = Resources.Load <Sprite>("Image/" + fileName) as Sprite; right.color = new Color(255f, 255f, 255, 1f); if (left.sprite != null) { left.color = new Color(100f, 100f, 100, 0.7f); } } } else if (row[2].Contains("play_se")) { //음악플레이 string fileName = row[3]; AudioSource audio = gameObject.AddComponent <AudioSource>(); AudioClip clip = (AudioClip)Resources.Load("sound/" + fileName); if (clip != null) { audio.PlayOneShot(clip); } } else if (row[2].Contains("move")) { //해당 루트로 이동 index = dialogBook[row[3]]; continue; } else if (row[2].Contains("route")) { //다음행으로 갈것 //암것도 안해도 됨 } else if (row[2].Contains("nextStage")) { string nextStageStr = row[3]; nextStage = int.Parse(nextStageStr); } else if (row[2].Contains("set_bg")) { if (backgroundImage.activeInHierarchy == false) { backgroundImage.SetActive(true); } string fileName = row[3]; Transform bg = UI.transform.Find("BackgroundImage"); Image bg_image = bg.GetComponent <Image>(); bg_image.sprite = Resources.Load <Sprite>("Image/" + fileName) as Sprite; } } else if ("l".Equals(row[1])) { //대사표시 UI.SetActive(true); UI.transform.Find("Name").Find("Text").GetComponent <Text>().text = row[2]; //UI.transform.Find("MainDialogue").Find("Text").GetComponent<Text>().text = row[3].Replace('$', ',').Replace(';', '\n'); //텍스트를 그냥 넣어주던 것을 StartTypeWriterOnText 함수로 넣어주도록 수정 Text temp = UI.transform.Find("MainDialogue").Find("Text").GetComponent <Text>(); string tempText = row[3].Replace('$', ',').Replace(';', '\n'); StartTypeWriterOnText(temp, tempText); yield return(new WaitForSeconds(1)); yield return(new WaitUntil(() => Input.touchCount > 0 || Input.GetMouseButtonUp(0) && EventSystem.current.IsPointerOverGameObject())); } else if (row[1].Contains("select")) { if (!"end".Equals(row[2])) { GameObject buttons = UI.transform.Find("Buttons").gameObject; GameObject button1 = buttons.transform.Find("Button1").gameObject; GameObject button2 = buttons.transform.Find("Button2").gameObject; GameObject button3 = buttons.transform.Find("Button3").gameObject; GameObject[] btnArr = new GameObject[] { button1, button2, button3 }; button1.SetActive(false); button2.SetActive(false); button3.SetActive(false); buttons.SetActive(true); int endIndex = dialogBook[row[1]]; for (int h = index; h <= endIndex; h++) { string[] searching = dialogRowsDual[h]; if (row[1].Equals(searching[1]) && searching[2].Contains("choice")) { int btnIndex = Int32.Parse("" + searching[2][searching[2].Length - 1]); int nextLine = h; btnArr[btnIndex - 1].transform.Find("Text").GetComponent <Text>().text = searching[3]; btnArr[btnIndex - 1].GetComponent <Button>().onClick.AddListener(() => { clicked = true; index = nextLine; }); btnArr[btnIndex - 1].SetActive(true); } } yield return(new WaitForSeconds(1)); yield return(new WaitUntil(() => { if (clicked) { foreach (GameObject go in btnArr) { go.GetComponent <Button>().onClick.RemoveAllListeners(); } clicked = false; return true; } else { return false; } })); buttons.SetActive(false); } } else { yield return(new WaitForSeconds(1)); } index++; } } Debug.Log(levelRows[j]); } } callback(true, nextStage); }
private void Awake() { Instance = this; }
void Start() { StoryController.resetStress(); StoryController.addStress(-20); }
void Update() { /* テキストを進めるための処理 */ Text speach_text = speach_object.GetComponent <Text>(); speach_text.text = speaches[text_index, 1]; /* 名前を表示するための処理 */ switch (speaches[text_index, 0]) { case "妻": case "俺": name_text_obj.SetActive(true); name_windows_obj.SetActive(true); name_text.text = speaches[text_index, 0]; break; default: name_text_obj.SetActive(false); name_windows_obj.SetActive(false); break; } /* 人物を変更するための処理 */ switch (speaches[text_index, 3]) { case "none": person_object.SetActive(false); break; case "wife": person_object.SetActive(true); change_person.sprite = wife_sprite; break; case "wife_angry": person_object.SetActive(true); change_person.sprite = wife_angry_sprite; break; case "wife_sad": person_object.SetActive(true); change_person.sprite = wife_sad_sprite; break; default: Debug.Log("キャラ画像表示エラー"); break; } /* 背景を変更するための処理 */ switch (speaches[text_index, 2]) { case "entrance": change_background.sprite = entrance_sprite; break; case "living": change_background.sprite = living_sprite; break; default: Debug.Log("背景画像表示エラー"); break; } /* クリックをしたときの処理 */ if (Input.GetMouseButtonDown(0)) { // テキストを読み終わった後の処理 if (text_index >= speaches.GetLength(0) - 1) { string end_status; if ((end_status = StoryController.getEndState()) != "") { if (end_status == "normal") { SceneManager.LoadScene("NormalEndScene"); } else { SceneManager.LoadScene("EndScene"); } } else if (StoryController.getQuizState() == "") { SceneManager.LoadScene("StoryScene"); } else { SceneManager.LoadScene("QuizScene"); } } if (text_index < speaches.GetLength(0) - 1) { text_index++; } } }
protected virtual void Start() { // get the game controller GameObject CLI = GameObject.Find ("CompetitionLawInfringeMent"); storyController = CLI.GetComponent<StoryController> (); // set the animations to loop animation["walk"].wrapMode = WrapMode.Loop; animation["sit"].wrapMode = WrapMode.Loop; animation["stand"].wrapMode = WrapMode.Loop; // set the walking animation speed animation["walk"].speed = 1.4f; }
protected override void FetchReferences() { base.FetchReferences(); story = StoryController.Instance; Load(); }
public void Awake() { StoryController = RegisterController <StoryController>(); }
public StoryControllerTest() { _gateway = new Mock <IStoryDataGateway>(); _client = new Mock <IProjectClient>(); _controller = new StoryController(_gateway.Object, _client.Object); }
static void Main(string[] args) { StoryController controller = new StoryController(new ColossalCaveStory()); controller.Run(); }