public string GetText() { string result = note.note; result = result.Replace(@"<DateTime>", recordTime.ToString()); result = result.Replace(@"<AgencyName>", Agency.GetInstantiate().agencyName); if (word != "" && word != null) { result = result.Replace(@"<key>", word); } else if (words.Count > 0) { List <string> array = new List <string>(); for (int i = 0; i < words.Count; i++) { if (result.Contains(string.Format("<{0}>", i))) { result = result.Replace(string.Format("<{0}>", i), words[i]); } else { array.Add(words[i]); } } if (array.Count > 0) { string pattern = ""; for (int i = 0; i < array.Count; i++) { pattern += array[i]; if (i < array.Count - 1) { pattern += ", "; } } result = result.Replace(@"<array>", pattern); } } return(result); }
public void ChangeActivity(DetectiveActivity newActivity, iActivityPlace newPlace) { if (activity != newActivity) { Office office = Agency.GetInstantiate().GetOffice(); if (activity == DetectiveActivity.IN_OFFICE) { office.detectivesInOffice.Remove(this); } else if (activity == DetectiveActivity.IN_HOME) { home.characterInHome = false; checkGoHome = false; } else if (activity == DetectiveActivity.IN_WAY) { } activity = newActivity; if (activity == DetectiveActivity.IN_OFFICE) { office.detectivesInOffice.Add(this); activityPlace = office; } else if (activity == DetectiveActivity.IN_HOME) { home.characterInHome = true; activityPlace = home; } else if (activity == DetectiveActivity.IN_WAY) { activityPlace = newPlace; } else if (activity == DetectiveActivity.IN_EVENT) { activityPlace = newPlace; } } }
public void DrawWay(float deltaTime, WayType wayType = WayType.MAINSTREET) { timeInWay += deltaTime * GetSpeedModifier(); lineRenderer.positionCount = 1; lineRenderer.SetPosition(0, startPlace.GetPoint().transform.position); float timeToPoint = 0; for (int i = 0; i < curWay.pointsAndPaths.Count; i++) { iWayPlace place = curWay.pointsAndPaths[i]; timeToPoint += place.GetTimeToWay(); if (place is PointOnMap) { lineRenderer.positionCount++; Vector3 wayPoint = new Vector3(place.GetPoint().transform.position.x, place.GetPoint().transform.position.y, place.GetPoint().transform.position.z + 0.01f * Agency.GetInstantiate().teams.IndexOf(this)); lineRenderer.SetPosition(lineRenderer.positionCount - 1, wayPoint); } else if (place is Path) { if (timeToPoint > timeInWay) { lineRenderer.positionCount++; float part = (timeInWay - timeToPoint + place.GetTimeToWay()) / place.GetTimeToWay(); PointOnMap end = (PointOnMap)curWay.pointsAndPaths[i + 1]; Vector3 partVector = ((Path)place).GetPointOnPath(end, part); Vector3 wayPoint = new Vector3(partVector.x, partVector.y, partVector.z + 0.01f * Agency.GetInstantiate().teams.IndexOf(this)); lineRenderer.SetPosition(lineRenderer.positionCount - 1, wayPoint); } } MapManager mapManager = MapManager.GetInstantiate(); if (detectives[0].activityPlace is iWayPlace && (iWayPlace)detectives[0].activityPlace == place) { if (timeToPoint <= timeInWay) { if (i == curWay.pointsAndPaths.Count - 1) { if (curTarget is Office) { ChangeActivity(DetectiveActivity.IN_OFFICE, curTarget); } else if (curTarget is DetectiveHome) { ChangeActivity(DetectiveActivity.IN_HOME, curTarget); } else if (curTarget is QuestEvent) { ChangeActivity(DetectiveActivity.IN_EVENT, curTarget); } Destroy(curWay.gameObject); } else { ChangeActivity(DetectiveActivity.IN_WAY, curWay.pointsAndPaths[i + 1]); } } break; } } }
public void Realize(iEffectsContainer effectsContainer, Team team) { this.effectsContainer = effectsContainer; Game game = Game.GetInstantiate(); Agency agency = Agency.GetInstantiate(); QuestManager questManager = QuestManager.GetInstantiate(); DetectiveManager detectiveManager = DetectiveManager.GetInstantiate(); UI.InterfaceManager interfaceManager = UI.InterfaceManager.GetInstantiate(); if (type == EffectType.INSTANTIATE_QUEST) { GameObject goFolder = null; if (agency.transform.Find("Quests")) { goFolder = agency.transform.Find("Quests").gameObject; } else { goFolder = new GameObject("Quests"); goFolder.transform.parent = agency.transform; } Quest questInstance = Instantiate(quest, goFolder.transform); agency.quests.Add(questInstance); questInstance.Realize(); } else if (type == EffectType.CHANGE_QUEST) { GetQuest().ChangeMainState(mainState); } else if (type == EffectType.CHANGE_TASK) { if (effectsContainer is QuestTask) { team.reportEvent.Add(questEvent); team.reportChangeTask.Add(task); team.reportTaskState.Add(mainState); if (mainState == MainState.Started && task.mainState == MainState.NotStarted) { team.reportQuest.Add(GetQuest()); List <string> keys = new List <string>() { questEvent.eventName, task.taskName }; FileNoteContainer noteContainer = FileNoteContainer.Create(Dialog.DialogManager.GetInstantiate().newTaskNote, team.transform, keys); team.reportNotes.Add(noteContainer); } } else { questEvent.ChangeTask(task, mainState); } } else if (type == EffectType.CHANGE_OBJECTIVE) { if (effectsContainer is QuestTask) { team.reportChangeObjective.Add(objective); team.reportObjectiveState.Add(mainState); } else { objective.state = mainState; } } else if (type == EffectType.CHANGE_QUEST_STATE || type == EffectType.CHANGE_DIALOG_STATE || type == EffectType.CHANGE_GLOBAL_STATE) { if (questState.type == QuestStateType.BOOL) { questState.boolValue = boolValue; } else if (questState.type == QuestStateType.INT) { questState.intValue = intValue; } else if (questState.type == QuestStateType.SPECIAL) { questState.specialValue = stringValue; } } else if (type == EffectType.ADD_FILE_NOTE) { foreach (FileNote fileNote in fileNotes) { if (fileNote != null) { if (effectsContainer is QuestTask) { team.reportQuest.Add(GetQuest()); team.reportNotes.Add(FileNoteContainer.Create(fileNote, team.transform)); } else { GetQuest().notes.Add(FileNoteContainer.Create(fileNote, GetQuest().transform)); } } } } else if (type == EffectType.ADD_ITEM) { if (team != null) { Item newItem = Instantiate(item); team.AddItem(newItem); team.reportQuest.Add(GetQuest()); FileNoteContainer noteContainer = FileNoteContainer.Create(Dialog.DialogManager.GetInstantiate().addItemNote, team.transform, newItem.itemName); team.reportNotes.Add(noteContainer); } else { Item newItem = Instantiate(item, agency.transform); agency.items.Add(newItem); } } else if (type == EffectType.CHANGE_MONEY) { agency.ChangeMoney(money); } else if (type == EffectType.REALIZE_TASK) { Team owner = effectsContainer.GetTeam(); if (owner != null) { if (!owner.targetTasks.Contains(task)) { owner.targetTasks.Insert(0, task); } } } else if (type == EffectType.REALIZE_LOGIC_MAP) { if (logicMapOwner == LogicMap.LogicMapOwnerType.QUEST) { logicMap.RealizeLogicMap(GetQuest(), team); } else if (logicMapOwner == LogicMap.LogicMapOwnerType.QUEST_TASK) { logicMap.RealizeLogicMap(task, team); } } else if (type == EffectType.START_DIALOG) { Dialog.DialogManager.GetInstantiate().StartDialog(dialog, team, GetQuest()); } else if (type == EffectType.FINALIZE_TASK) { task.FinalizeTask(); } else if (type == EffectType.TEAM_GOTO_OFFICE) { if (team != null) { team.GoTo(agency.GetOffice(), team.GetPriorityWay(), true); } } else if (type == EffectType.TEAM_GOTO_HOMES) { if (team != null) { for (int i = 0; i < team.detectives.Count; i++) { team.detectives[i].ReturnToHome(); i--; } } } else if (type == EffectType.TEAM_GOTO_EVENT) { if (team != null) { game.ChangeGameState(GameState.WAIT_ACTIVITY_CHOICE); detectiveManager.teamOnWait = team; interfaceManager.detectiveRow.ResetRow(); } } else if (type == EffectType.TELEPORT_TO_EVENT) { if (team.curTarget is QuestEvent) { ((QuestEvent)team.startPlace).RemoveTeam(team); team.startPlace = questEvent; questEvent.AddTeam(team); } } else if (type == EffectType.TIMELINE_ACTION_CHANGE_QUEST_STATE) { Timeline timeline = Timeline.GetInstantiate(); GameObject goAction = new GameObject(string.Format("TimelineAction_ChangeQuestState")); goAction.transform.parent = timeline.transform; TimelineAction action = goAction.AddComponent <TimelineAction>(); action.actionType = TimelineActionType.CHANGE_QUEST_STATE; action.questState = questState; action.flag = boolValue; action.value = intValue; action.specialValue = stringValue; if (waitType == LogicMap.WaitType.ABSOLUTE) { action.timer = GameTime.ConvertToFloat(waitTime); } else if (waitType == LogicMap.WaitType.RELATION) { action.timer = timeline.GetTime() + GameTime.ConvertToFloat(waitTime); } timeline.RegistrateAction(action); } else if (type == EffectType.CHECK_QUEST) { } }