private void ExecuteCommand(ScriptCmd cmd) { if (cmd != null) { if (GlobalVars.Instance.tutorFirstScriptOn) { TutorHelpDialog tutorHelpDialog = (TutorHelpDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.TUTORHELP, exclusive: true); if (tutorHelpDialog != null) { tutorHelpDialog.InitDialog(); GlobalVars.Instance.tutorFirstScriptOn = false; } } switch (cmd.GetName()) { case "EnableScript": EnableScript(((EnableScript)cmd).Id, ((EnableScript)cmd).Enable); break; case "ShowDialog": ShowDialog(((ShowDialog)cmd).Speaker, ((ShowDialog)cmd).Dialog); break; case "PlaySound": PlaySound(((PlaySound)cmd).Index); break; case "Sleep": Sleep(((Sleep)cmd).Howlong); break; case "Exit": Exit(); break; case "ShowScript": ShowScript(((ShowScript)cmd).Id, ((ShowScript)cmd).Visible); break; case "GiveWeapon": GiveWeapon(((GiveWeapon)cmd).WeaponCode); break; case "TakeAwayAll": TakeAwayAll(); break; case "SetMission": SetMission(((SetMission)cmd).Progress, ((SetMission)cmd).Title, ((SetMission)cmd).SubTitle, ((SetMission)cmd).Tag); break; } } }
private void GiveWeapon(string weaponCode) { GameObject gameObject = GameObject.Find("Me"); if (null != gameObject) { LocalController component = gameObject.GetComponent <LocalController>(); if (null != component) { component.PickupFromTemplate(weaponCode); if (weaponCode != "waf") { TutorHelpDialog tutorHelpDialog = (TutorHelpDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.TUTORHELP, exclusive: true); if (tutorHelpDialog != null) { tutorHelpDialog.OpenNext((!(GlobalVars.Instance.preWeaponCode == weaponCode)) ? true : false); GlobalVars.Instance.preWeaponCode = weaponCode; } } } } }