/// <summary> /// Tells the Dialogue System to restore its state from an AC global /// variable after loading a game. /// </summary> public void PostLoad() { if (DialogueDebug.LogInfo) { Debug.Log("Restoring Dialogue System state from Adventure Creator."); } AdventureCreatorBridge.LoadDialogueSystemFromGlobalVariable(); }
/// <summary> /// Tells the Dialogue System to save its state into an AC global variable prior /// to saving a game, unless DialogueSystemSceneSync has already saved it. /// </summary> public void PreSave() { if (!saveWhenChangingLevels) { if (DialogueDebug.LogInfo) { Debug.Log("Adding Dialogue System state to the saved game."); } AdventureCreatorBridge.SaveDialogueSystemToGlobalVariable(); } }
/// <summary> /// Tells the Dialogue System to save its state into an AC global variable /// prior to changing levels (or saving a game). /// </summary> public override string SaveData() { if (saveWhenChangingLevels) { if (DialogueDebug.LogInfo) { Debug.Log("Saving Dialogue System state to Adventure Creator."); } AdventureCreatorBridge.SaveDialogueSystemToGlobalVariable(); } return(string.Empty); }
public void Start() { string mode = GetParameter(0); bridge = DialogueManager.Instance.GetComponent<AdventureCreatorBridge>(); if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: ACCam({1})", DialogueDebug.Prefix, mode)); if (bridge == null) { if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: ACCam({1}): Can't find AdventureCreatorBridge", DialogueDebug.Prefix, mode)); } else if (string.Equals(mode, "on", System.StringComparison.OrdinalIgnoreCase)) { bridge.EnableACCameraControl(); } else if (string.Equals(mode, "off", System.StringComparison.OrdinalIgnoreCase)) { bridge.DisableACCameraControl(); } else if (string.Equals(mode, "idle", System.StringComparison.OrdinalIgnoreCase)) { bridge.IdleACCameraControl(); } else { SetGameCamera(mode, GetParameterAsFloat(1)); } Stop(); }
/// <summary> /// After loading options, update the Dialogue System's localization in case /// the player changed AC's language. /// </summary> public void PostLoadOptions() { AdventureCreatorBridge.UpdateLocalization(); }
/// <summary> /// After changing options, update the Dialogue System's localization in case /// the player changed AC's language. /// </summary> public void PreSaveOptions() { AdventureCreatorBridge.UpdateLocalization(); }
public void Start() { bridge = DialogueManager.Instance.GetComponent<AdventureCreatorBridge>(); actionListManager = KickStarter.actionListManager; string actionListSpecifier = GetParameter(0); bool wait = !string.Equals(GetParameter(1), "nowait"); int startAt = GetParameterAsInt(2); bool addToSkipQueue = true; // Look for a GameObject in the scene matching the specified name: GameObject actionListObject = GameObject.Find(actionListSpecifier); if (actionListObject != null) { actionList = actionListObject.GetComponent<ActionList>(); if (actionList != null) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt), actionListObject); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList.Interact(); } else { actionList.Interact(startAt, addToSkipQueue); } } } // Failing that, look for other GameObjects in the scene matching the name: if (actionList == null) { foreach (GameObject go in GameObject.FindObjectsOfType<GameObject>()) { if (string.Equals(go.name, actionListSpecifier)) { actionList = go.GetComponent<ActionList>(); if (actionList != null) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt), go); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList.Interact(); } else { actionList.Interact(startAt, addToSkipQueue); } break; } } } } // Failing that, try Resources.Load: if (actionList == null) { var actionListAsset = Resources.Load(actionListSpecifier) as ActionListAsset; if (actionListAsset) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list asset", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt)); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList = AdvGame.RunActionListAsset(actionListAsset); } else { actionList = AdvGame.RunActionListAsset(actionListAsset, startAt, addToSkipQueue); } } } // Failing that, look for an ActionListAsset in all resources of the project: if (actionList == null) { foreach (ActionListAsset actionListAsset in Resources.FindObjectsOfTypeAll(typeof(ActionListAsset)) as ActionListAsset[]) { if (string.Equals(actionListSpecifier, actionListAsset.name, System.StringComparison.OrdinalIgnoreCase)) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list asset", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt)); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList = AdvGame.RunActionListAsset(actionListAsset); } else { actionList = AdvGame.RunActionListAsset(actionListAsset, startAt, addToSkipQueue); } break; } } } if (actionList == null) { if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AC(): Can't find action list '{1}'", DialogueDebug.Prefix, actionListSpecifier)); Stop(); } if (!wait) Stop(); }