public override void Initialize() { instance = this; if (run.stageScript == null) { return; } string[] data = run.stageScript.text.Split('\n'); int count = data.Length; for (int i = 0; i < count - 1; ++i) { Options option = new Options(); string[] deepData = data[i].Split('/'); option.auto = bool.Parse(deepData[0]); option.skip = bool.Parse(deepData[1]); option.speed = float.Parse(deepData[2]); option.talker = int.Parse(deepData[3]); option.name = deepData[4]; option.mainText = deepData[5]; options.Add(option); } gameObject.SetActive(false); }
private void WO_NPC_OnDestroy() { if (_dialog != null) { _dialog.NPC[_npc.DialogIndex] = null; if (_owner != null) { _server.Dialogs.RemoveClone(_dialog.ID, _owner); } } if (_owner != null) { _owner.Clones.Remove(_npc.ID); } if (_original != null && !_original.IsDead) { _original._view.RebuildVisibility(); } m_char = null; _wears = null; _owner = null; _dialog = null; _original = null; shop_ser = default(SER_Shop); wears_ser = default(SER_Wears); }
public void SetText(params string[] str) { dialog = GetComponent <DialogScript>(); dialog.textScript = new TextScript(str); dialog.maxPhrase = str.Length - 1; }
void Awake() { if (!dialog) { dialog = DialogScript.instance; } }
//player touches the trigger and get thrown back. Guards say mean things. void OnTriggerEnter2D(Collider2D coll) { if (coll.CompareTag("Playa")) { dialog.text = DialogScript.getDialog(11); spotted = true; } }
public DialogScript GetDialog(ushort id) { if (!_dialogs.TryGetValue(id, out var ret) && DataMgr.Select(id, out DB_Dialog data)) { _dialogs[id] = ret = new DialogScript(data, _server); } return(ret); }
public void StartDialog(DialogScript s) { gameObject.SetActive(true); currentScript = s; currentMessage = 0; textTimer = 0.0f; prevNumLetters = 0; }
void OnTriggerEnter2D(Collider2D coll) //guard collider checks for player and deals damage, says some stuff, invokes checkstatus method. { if (coll.CompareTag("Playa")) { StatKeeper.receiveDamage(4); dialog.text = DialogScript.getDialog(14); spotted = true; } }
/// <summary> /// If rose is given, it will be removed from inventory and wench will no longer attack the player if seen. /// </summary> void YesButtonClicked() { hideStory(); InventoryHandler.GiveRose(); roseGiven = true; boxCollider.enabled = false; dialog.text = DialogScript.getDialog(6); }
void OnTriggerEnter2D(Collider2D coll) //guard collider checks for player and deals damage, says some stuff, invokes checkstatus method. { if (coll.CompareTag("Playa")) { //StatKeeper.receiveDamage(4); SoundManager.instance.musicSource.PlayOneShot(guard, 1.0f); dialog.text = DialogScript.getDialog(14); spotted = true; } }
private void Start() { mover = FindObjectOfType <CharacterMover>(); dialogScript = Instantiate(dialogScript); dialogUI = FindObjectOfType <DialogUI>(); if (!dialogUI) { Debug.LogWarning("No DialogUI found in scene!"); } }
public WO_NPC(DB_WorldObject data, ObjectsMgr manager) : base(manager.GetNewGuid() | Constants.ReleaseGuide, manager) { _data = data; if (!DataMgr.Select(data.ObjectID, out _npc)) { ServerLogger.LogError($"NPC id {data.ObjectID} doesn't exist"); } if ((_npc.Flags & NPCFlags.Dialog) > 0) { _dialog = _server.Dialogs.GetDialog(_npc.Dialog); } if ((_npc.Flags & NPCFlags.Trader) > 0) { shop_ser = new SER_Shop(_npc.Items, $"{_npc.Pony.Name}'s shop"); } if ((_npc.Flags & NPCFlags.Wears) > 0) { DB_Item entry; byte slot; _wears = new Dictionary <int, InventoryItem>(); wears_ser = new SER_Wears(_wears); foreach (var item in _npc.Wears) { if (item > 0 && DataMgr.Select(item, out entry)) { slot = entry.Slot.ToWearableIndex(); if (_wears.ContainsKey(slot)) { ServerLogger.LogWarn($"NPC id {data.ObjectID} duplicate wear slot {entry.Slot}"); } else { _wears[slot] = new InventoryItem(item); } } } } OnSpawn += WO_NPC_OnSpawn; OnDespawn += WO_NPC_OnDespawn; OnDestroy += WO_NPC_OnDestroy; if ((_npc.Flags & NPCFlags.ScriptedMovement) > 0) { AddComponent(new ScriptedMovement(_npc.Movement, this)); } else { AddComponent(new NullMovement(this)); } m_char = new Character(_npc.ID, -1, _npc.Level, -1, _npc.Pony, null); Spawn(); }
public WO_NPC(WO_NPC original, MapPlayer owner) : base(original._manager.GetNewGuid() | Constants.CRObject, original._manager) { _owner = owner; _original = original; _npc = original._npc; _data = original._data; if ((_npc.Flags & NPCFlags.Dialog) > 0) { _dialog = _server.Dialogs.GetClone(_npc.Dialog, owner); } if ((_npc.Flags & NPCFlags.Trader) > 0) { shop_ser = new SER_Shop(_npc.Items, $"{_npc.Pony.Name}'s shop"); } if ((_npc.Flags & NPCFlags.Wears) > 0) { DB_Item entry; byte slot; _wears = new Dictionary <int, InventoryItem>(); wears_ser = new SER_Wears(_wears); foreach (var item in _npc.Wears) { if (item > 0 && DataMgr.Select(item, out entry)) { slot = entry.Slot.ToWearableIndex(); if (_wears.ContainsKey(slot)) { ServerLogger.LogWarn($"NPC id {_data.ObjectID} duplicate wear slot {entry.Slot}"); } else { _wears[slot] = new InventoryItem(item); } } } } OnSpawn += WO_NPC_OnSpawn; OnDespawn += WO_NPC_OnDespawn; OnDestroy += WO_NPC_OnDestroy; if ((_npc.Flags & NPCFlags.ScriptedMovement) > 0) { AddComponent(new ScriptedMovement(original._movement as ScriptedMovement, this)); } else { AddComponent(new NullMovement(this)); } m_char = new Character(_npc.ID, -1, _npc.Level, -1, _npc.Pony, null); Spawn(); }
public void CreateDialog(string strJsonDialog) { DialogData jsonDialog = JsonUtility.FromJson <DialogData>(strJsonDialog); DialogScript dialogScript = null; dialogScript = gameObject.GetComponent <DialogScript>(); if (dialogScript == null) { dialogScript = gameObject.AddComponent <DialogScript>(); } //dialogScript = gameObject.AddComponent<DialogScript>(); dialogScript.CreateDialog(jsonDialog); }
// Use this for initialization void Awake() { dScript = GetComponent <DialogScript>(); //dialogText.text = ""; isOptionSelect = false; optionsButtonObj1.SetActive(false); optionsButtonObj2.SetActive(false); optionsButtonObj3.SetActive(false); nextButton.SetActive(false); dialogText.text = "Hello?"; }
public void displayNextMessage() { if (!readyToAdvance()) { return; } currentMessage++; textTimer = 0.0f; if (currentMessage >= currentScript.getNumLines()) { currentScript.OnDialogComplete.Invoke(); currentScript = null; gameObject.SetActive(false); return; } //setTextToCurrentMessage(); }
// Use this for initialization void Start() { DialogLine [] dialogLines = new DialogLine[4]; dialogLines [0] = new DialogLine(DialogLine.CharPosition.LEFT, "Alors ? Les recherches avancent ?"); dialogLines [1] = new DialogLine(DialogLine.CharPosition.RIGHT, "Oui, nous devrions avoir accès au tombeau dans l'après midi"); dialogLines [2] = new DialogLine(DialogLine.CharPosition.RIGHT, "Qu'est ce que tu vas faire en attendant ?"); dialogLines [3] = new DialogLine(DialogLine.CharPosition.LEFT, "Je vais rentrer, je ne vais pas passer l'aprèm à vous regarder bosser"); dialogScript.dialogLineArray = dialogLines; dialogScript.Save("DialogFiles/test_script.xml"); dialogScript = DialogScript.Load("DialogFiles/test_script.xml"); }
// Use this for initialization private void Start() { dialogScript = GetComponent <DialogScript> (); characterAnimator = GetComponent <Animator> (); characterMovement = GetComponent <CharacterMovement>(); animationReference = GetComponent <CharacterAnimationReference>(); Movements = new CharacterDisplacement[(int)CharacterState.Count]; // init array of delegates // Set each action delegate stateMode = CharacterState.StandBy; nextStateMode = CharacterState.StandBy; Movements [(int)CharacterState.Idle] = idle; Movements [(int)CharacterState.Move] = move; Movements [(int)CharacterState.Turn] = rotateCharacterTowards; Movements [(int)CharacterState.StandBy] = standBy; EventManager.startListening(Events.EventList.STATE_Pause, pauseThisCharacterManager); EventManager.startListening(Events.EventList.STATE_Continue, continueThisCharacterManager); }
// Start is called before the first frame update void Start() { StartTime = Time.time; sprites = new List <List <Sprite> >() { dangerDialSprites, detourDialSprites, randomDialSprites, }; bossHologram = GameObject.Find("BossHologram").GetComponent <SpriteRenderer>(); humanHologram = GameObject.Find("HumanHologram").GetComponent <SpriteRenderer>(); gauges = GameObject.FindGameObjectsWithTag("Gauge"); damageIcons = GameObject.FindGameObjectsWithTag("DamageIcon"); dialog = GameObject.Find("DialogCanvas").GetComponent <DialogScript>(); incomeTime = Time.time; }
public static void setActiveSprite(int choice) { ballStates[0] = true; ballStates[1] = true; DialogScript dialogScript = new DialogScript(); if (ballStates[choice]) { selectedSpriteIndex = choice; string key = "ballSpriteIndex"; PlayerPrefs.SetInt(key, selectedSpriteIndex); } else { int cost; if (choice < 10) { cost = 100; } else { cost = 200; } int coins; coins = GameOverScript.getCoins(); if (coins >= cost) { coins -= cost; string key = "coins"; PlayerPrefs.SetInt(key, coins); ballStates[choice] = true; PlayerPrefs.SetInt(ballKeys[choice], 1); } else if (coins < cost) { dialogScript.showDialog("You don't have enough coins. Sorry"); } } }
public DialogScript GetClone(ushort id, MapPlayer owner) { DialogScript ret = null; if (_dialogs.TryGetValue(id, out var original)) { if (_dClones.TryGetValue(owner.Player.Id, out var clones)) { if (!clones.TryGetValue(id, out ret)) { clones[id] = ret = new DialogScript(original); } } else { _dClones[owner.Player.Id] = new Dictionary <ushort, DialogScript>() { { id, ret = new DialogScript(original) } } }; } return(ret); } }
private void Awake() { addButton.onClick.AddListener(AddEvent); removeButton.onClick.AddListener(() => RemoveEvent(lastSelected.transform.GetSiblingIndex())); playButton.onClick.AddListener(StartPlaying); minimuzedPlayButton.onClick.AddListener(StartPlaying); maximizeButton.onClick.AddListener(ToggleHideUI); foreach (string asset in AssetDatabase.FindAssets("t:DialogScript")) { DialogScript data = AssetDatabase.LoadAssetAtPath <DialogScript>(AssetDatabase.GUIDToAssetPath(asset)); scriptDropdown.options.Add(new TMP_Dropdown.OptionData(data.name)); } durationInput.onValueChanged.AddListener(delegate(string arg0) { UpdateDuration(arg0); }); scriptDropdown.onValueChanged.AddListener(UpdateScript); scriptDropdown.SetValueWithoutNotify(0); scriptDropdown.RefreshShownValue(); foreach (object value in Enum.GetValues(typeof(DialogEventType))) { eventTypeDropdown.options.Add(new TMP_Dropdown.OptionData(value.ToString())); } eventTypeDropdown.onValueChanged.AddListener(delegate(int arg0) { UpdateEventType(arg0); }); foreach (string asset in AssetDatabase.FindAssets("t:CharacterData")) { CharacterData data = AssetDatabase.LoadAssetAtPath <CharacterData>(AssetDatabase.GUIDToAssetPath(asset)); characterDropdown.options.Add(new TMP_Dropdown.OptionData(data.name)); } characterDropdown.onValueChanged.AddListener(delegate(int arg0) { UpdateCharacter(AssetDatabase.LoadAssetAtPath <CharacterData>( $"Assets/Data/Characters/{characterDropdown.options[arg0].text}.asset")); }); animTriggerInput.onEndEdit.AddListener(UpdateAnimTrigger); spriteTriggerInput.onEndEdit.AddListener(UpdateSpriteTrigger); targetXInput.onEndEdit.AddListener(delegate { UpdateTarget(new Vector2Int(int.Parse(targetXInput.text), int.Parse(targetYInput.text))); }); targetYInput.onEndEdit.AddListener(delegate { UpdateTarget(new Vector2Int(int.Parse(targetXInput.text), int.Parse(targetYInput.text))); }); targetPickButton.onClick.AddListener(delegate { StartCoroutine(PickTarget()); }); textInput.onEndEdit.AddListener(UpdateText); toggleL.onValueChanged.AddListener(delegate(bool arg0) { lastSelected.dialogEvent.leftCharacter = arg0; UpdateScriptEvents(); Debug.Log(lastSelected.dialogEvent.leftCharacter); }); }
private void Start() { dialogScript = dialog.GetComponent <DialogScript>(); }
public NegativeButtonListner(DialogScript d) : base("android.content.DialogInterface$OnClickListener") { mDialog = d; }
private void Awake() { dialog = GetComponent <DialogScript>(); }
void Awake() { instance = this; transform.gameObject.SetActive(false); }
private void Awake() { singleton = this; audioSource = GetComponent <AudioSource>(); gameObject.SetActive(false); }
void OnMouseDown() { Debug.Log("neeew"); Debug.Log(this.transform.gameObject.name); Name = this.transform.gameObject.name; Canvas dialogCanvas = GameObject.Find("DialogCanvas").GetComponent <Canvas>(); DialogScript dialogScript = GameObject.Find("Dialog").GetComponent <DialogScript>(); Debug.Log(dialogScript.nameText.text); Debug.Log(dialogScript.questionText.text); if (name == "DudeHungry") { Debug.Log("Hungry duuuudee"); dialogScript.UpdateDialog("DudeHungry"); hungryDude.GetComponent <Renderer>().enabled = inventory.GetComponent <InventoryScript>().HungryDude(); dude.GetComponent <Renderer>().enabled = inventory.GetComponent <InventoryScript>().PhoneLostDude(); } else if (name == "Dude") { Debug.Log("Nowww duuuudee"); if (inventory.GetComponent <InventoryScript>().phone) { dialogScript.UpdateDialog("DudeWithPhone"); inventory.GetComponent <InventoryScript>().dudeLeft = true; } else { dialogScript.UpdateDialog("Dude"); } dude.GetComponent <Renderer>().enabled = inventory.GetComponent <InventoryScript>().PhoneLostDude(); } else if (name == "Fridge") { Debug.Log("Im a fridge"); if (inventory.GetComponent <InventoryScript>().snacks) { dialogScript.UpdateDialog("Fridge"); } else { dialogScript.UpdateDialog("FridgeEmpty"); } } else if (name == "Bag") { Debug.Log("Im a bag"); if (inventory.GetComponent <InventoryScript>().PhoneLostDude()) { dialogScript.UpdateDialog("Bag"); } } else if (name == "Neighbor") { Debug.Log("Im a neighbor, sooo ooold"); dialogScript.UpdateDialog("Neighbor"); } else if (name == "Remppa") { Debug.Log("Wufff wuffff"); dialogScript.UpdateDialog("Remppa"); inventory.GetComponent <InventoryScript>().Dog(); } else if (name == "Back") { Debug.Log("Go out for adventure"); SceneManager.LoadScene("World"); } else if (name == "Drinks") { dialogScript.UpdateDialog("Drinks"); /* * if (inventory.GetComponent<InventoryScript>().money >= 10) * { * inventory.GetComponent<InventoryScript>().drinks = true; * inventory.GetComponent<InventoryScript>().MoneyChange(-10); * }*/ } else if (name == "Pizza") { dialogScript.UpdateDialog("Pizza"); /* * if (inventory.GetComponent<InventoryScript>().money >= 10) * { * inventory.GetComponent<InventoryScript>().pizza = true; * inventory.GetComponent<InventoryScript>().MoneyChange(-10); * }*/ } else if (name == "Vegetables") { dialogScript.UpdateDialog("Vegetables"); /* * if (inventory.GetComponent<InventoryScript>().money >= 10) * { * inventory.GetComponent<InventoryScript>().vegetables = true; * inventory.GetComponent<InventoryScript>().MoneyChange(-10); * }*/ } else if (name == "Snacks") { dialogScript.UpdateDialog("Snacks"); /* * if (inventory.GetComponent<InventoryScript>().money >= 10) * { * inventory.GetComponent<InventoryScript>().snacks = true; * inventory.GetComponent<InventoryScript>().MoneyChange(-10); * } */ } else if (name == "TV") { if (inventory.GetComponent <InventoryScript>().EndGame()) { SceneManager.LoadScene("EndScene"); } } }
void Awake() { S = this; }
private void UpdateScript(int i) { dialogScript = AssetDatabase.LoadAssetAtPath <DialogScript>( $"Assets/Data/Dialog/{scriptDropdown.options[i].text}.asset"); DrawList(); }
void Awake() { instance = this; transform.gameObject.SetActive (false); }
public void SetDialogScript(DialogScript d) { dialog = d; }