private void OnDeactivate(TutorialObject _tutorialObject) { // TODO: Clean UI and hide object highlighters _tutorialWindow.SetActive(false); _doctorObject.SetActive(false); _UIHighlight.gameObject.SetActive(false); }
void Start() { tutorialObject = Resources.Load <TutorialObject>("Tutorials/" + MinigameManager.nextMinigame + "Tutorial"); minigameName.text = tutorialObject.codename; minigameDesc.text = tutorialObject.gameRules; minigameThumbnail.texture = tutorialObject.image; }
public TutorialPart LoadFile(int Location, string FileName) { TutorialObject tester = JsonUtility.FromJson <TutorialObject>(File.ReadAllText(FileName)); //Debug.Log(tester.Parts.Count); return(tester.Parts[Location]); }
public void ProtocolSelected(TutorialObject t) { Color convertedColor = t.color; Debug.Log("start"); titleBarImage.color = convertedColor; titleBarText.text = t.title; goalsHeadline.color = convertedColor; materialsHeadline.color = convertedColor; goals.text = t.goal; goals.color = convertedColor; materials.text = t.materials; materials.color = convertedColor; Debug.Log(buttonAR); buttonAR.GetComponent <Image>().color = convertedColor; buttonVideo.GetComponent <Image>().color = convertedColor; buttonVideo.GetComponent <VideoHandler>().clip = t.video; MenuCanvas.SetActive(false); SelectedProtocolCanvas.SetActive(true); RememberProtocol.control.protocol = t; Debug.Log("End"); }
private void OnActive(TutorialObject obj) { _activeSection = 0; _tutorialWindow.SetActive(true); _doctorObject.SetActive(true); UpdateSection(); }
public void DeactivateTutorial() { TutorialObject _oldObject = _activeTutorial; _activeTutorial = null; OnDeactivate?.Invoke(_oldObject); }
private void OnSectionChange(TutorialObject.TutorialSection _section, TutorialObject _object) { _activeSection = _section; if (TutorialSystem.Instance.ActiveTutorial.TutorialID == "basic-ui" && _activeSection.Name == "de-camera") { _mainCameraOriginalPosition = Camera.main.transform.position; } }
public void SetInfoScreen(TutorialObject tutorialObject) { UpdateInputArrows(); minigameLabel.text = tutorialObject.minigameName; gameArt.texture = tutorialObject.image; GetComponent <SelectButtonOnEnable>().firstSelection = buttons[index]; selectorDisplay.ResetValue(); UpdateTextDisplay(); }
private void ShowEditorPanel() { EditorGUILayout.LabelField("Tutorial Data"); GuiLine(); EditorGUILayout.Space(10); _selectedObject.TutorialName = EditorGUILayout.TextField("Tutorial Name", _selectedObject.TutorialName); _selectedObject.TutorialID = EditorGUILayout.TextField("Tutorial ID", _selectedObject.TutorialID); _selectedObject.isEnabled = EditorGUILayout.Toggle("Is Enabled", _selectedObject.isEnabled); EditorGUILayout.Space(10); GuiLine(); EditorGUILayout.LabelField("Tutorial Sections"); GuiLine(); EditorGUILayout.Space(10); if (_selectedObject.TutorialSections != null) { for (int i = 0; i < _selectedObject.TutorialSections.Length; i++) { ShowSectionEditor(ref _selectedObject.TutorialSections[i]); } } EditorGUILayout.Space(10); GuiLine(); EditorGUILayout.LabelField("Create Section"); GuiLine(); _tutorialSectionName = EditorGUILayout.TextField("Section Name", _tutorialSectionName); if (GUILayout.Button("Create new section")) { // TODO: Switch to editor panel _selectedObject.TutorialSections = AddSection(_tutorialSectionName); } GuiLine(); EditorGUILayout.Space(5); if (GUILayout.Button("Save Tutorial")) { EditorUtility.SetDirty(_selectedObject); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } if (GUILayout.Button("Back to list")) { _selectedObject = null; } }
private void SetCurrentMatchup(Matchup matchup) { PlayersManager.currentLeftPlayer = matchup.leftPlayer; currentLeftPlayer = medleyManager.GetPlayerAt(matchup.leftPlayer); leftPlayerIcon.Init(currentLeftPlayer.title, currentLeftPlayer.score, currentLeftPlayer.color); PlayersManager.currentRightPlayer = matchup.rightPlayer; currentRightPlayer = medleyManager.GetPlayerAt(matchup.rightPlayer); rightPlayerIcon.Init(currentRightPlayer.title, currentRightPlayer.score, currentRightPlayer.color); currentMinigame = GetRandomMinigame(); minigameTitle.text = currentMinigame.minigameName; }
public void ActivateTutorial(string _tutorialID) { TutorialObject _object = _tutorialObjects.Find(o => o.TutorialID == _tutorialID); if (_object != null) { _activeTutorial = _object; OnActive?.Invoke(_activeTutorial); } else { throw new ArgumentNullException("Tutorial Not Found"); } }
public void NextSection() { TutorialObject _activeTutorial = TutorialSystem.Instance.ActiveTutorial; _activeSection += 1; if (_activeTutorial.TutorialSections.Length <= _activeSection) { TutorialSystem.Instance.DeactivateTutorial(); } else { UpdateSection(); } }
public void Init(ButtonsRoulette roulette, TutorialObject tutorialObject) { this.roulette = roulette; this.tutorialObject = tutorialObject; Button button = GetComponent <Button>(); if (button) { button.onClick.AddListener(() => CallMinigame()); } if (icon && tutorialObject.icon != null) { icon.texture = tutorialObject.icon; } }
/// <summary> /// Set-up the values required for displaying this part of the tutorial /// </summary> public void Construct(TutorialObject tutObj) { _attributeDict.Clear(); _tutorialObj = tutObj; _sectionText = new Dictionary <string, List <string> >(); tutObj.SectionTextHolder.ForEach(st => _sectionText.Add(st.Key, st.Value)); _tutorialObject = UIManagement.Tutorial.SectionCount == GameManagement.TutorialStage + 1 ? transform.parent.FindObject("End Close/Tutorial Helper") : transform.FindObject("Tutorial Helper"); _buttons = _tutorialObject.transform.FindRect("Buttons"); _tutorialText = _tutorialObject.GetComponentInChildren <Text>(); _attributeDict = tutObj.CustomAttributes.Select(a => new KeyValuePair <string, string>(a.Split('=')[0], a.Split('=')[1])).ToDictionary(c => c.Key, c => c.Value); GameManagement.GameManager.SetCustomTutorialAttributes(GameManagement.TutorialStage, _attributeDict); _currentText = 0; _eventTriggerCount = 0; _triggeredObjects.Clear(); _unblocked = false; SetUp(); }
private void OnDeactivate(TutorialObject _tutorialObject) { if (_tutorialObject.TutorialID == "basic-ui") { TutorialSystem.Instance.ActivateTutorial("first-program"); } if (_tutorialObject.TutorialID == "first-program") { if (PatientSystem.Instance.GetNextPatient() == null) { // Well this is not supposed to happen. But then we just move back to main menu LevelSystem.Instance.ChangeToMainMenu(); return; } PatientSystem.Instance.SetActivePatient(PatientSystem.Instance.GetNextPatient()); PatientSystem.Instance.AutoContinue = true; } }
public void SpawnTutorialAI() { Vector3 pos = new Vector3(0, 0, -1) - player.transform.position; Vector3 spawnPoint = player.transform.position + (pos.normalized * 6); spawnPoint.z = -1; Character ch; ch.animal = "dog"; ch.cup = "teacup"; ch.liquid = "wine"; ch.name = "阿福"; GameObject playerObj = PhotonNetwork.InstantiateSceneObject(PhotonManager.getInstance().playerObj.name, spawnPoint, PhotonManager.getInstance().playerObj.transform.rotation, 0, null); PlayerController playerController = playerObj.GetComponent <PlayerController>(); TutorialObject tutorialObj = playerObj.AddComponent <TutorialObject>(); tutorialObj.triggerType = TriggerType.OnCollisionEnter; if (tutorialObj.TriggerTurtorialEvent == null) { tutorialObj.TriggerTurtorialEvent = new UnityEvent(); } tutorialObj.TriggerTurtorialEvent.AddListener(MoveNext); tutorialObj.TriggerTurtorialEvent.AddListener(() => SetPlayerCanMove(false)); tutorialObj.TriggerTurtorialEvent.AddListener(() => player.Damaged(8)); tutorialObj.TriggerTurtorialEvent.AddListener(StopPlayer); tutorialObj.TriggerTurtorialEvent.AddListener(() => CoroutineUtility.GetInstance().Do().Wait(1f).Then(StopAI).Go()); tutorialObj.TriggerTurtorialEvent.AddListener(() => CoroutineUtility.GetInstance().Do().Wait(0.2f).Then(() => Destroy(tutorialObj)).Go()); //playerList.Add(playerController); PhotonManager.getInstance().playerList.Add(playerController); int id = -1; playerController.willDamaged = false; playerObj.GetPhotonView().RPC("Initial", PhotonTargets.AllBuffered, 2, id, true, ch.name); playerObj.GetPhotonView().RPC("SetCharacterSprite", PhotonTargets.AllBuffered, ch.animal, ch.cup, ch.liquid); playerObj.GetPhotonView().RPC("SetSkill", PhotonTargets.AllBuffered, ch.animal); playerController.canMove = false; tutorialAI = playerController; }
private void ShowTutorialList() { // Show Creation Button _tutorialName = EditorGUILayout.TextField("Tutorial Name", _tutorialName); if (GUILayout.Button("Create new tutorial")) { // TODO: Switch to editor panel TutorialObject _tutorialObject = ScriptableObject.CreateInstance <TutorialObject>(); _tutorialObject.TutorialName = _tutorialName; AssetDatabase.CreateAsset(_tutorialObject, $"Assets/Resources/Tutorials/{_tutorialName}.asset"); AssetDatabase.SaveAssets(); } GuiLine(); EditorGUILayout.Space(15); // List Tutorials EditorGUILayout.LabelField("List of tutorials:"); GuiLine(); TutorialObject[] _tutorials = LoadTutorials(); foreach (TutorialObject _tutorial in _tutorials) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(_tutorial.TutorialName); if (GUILayout.Button("Edit")) { _selectedObject = _tutorial; } EditorGUILayout.EndHorizontal(); GuiLine(); } }
private void UpdateSection() { TutorialObject _activeTutorial = TutorialSystem.Instance.ActiveTutorial; if (_activeTutorial.TutorialSections.Length > _activeSection) { TutorialObject.TutorialSection _section = _activeTutorial.TutorialSections[_activeSection]; OnSectionChange?.Invoke(_section, _activeTutorial); // Reposition Tutorial window UpdateWindowPosition(_section.PanelPosition); if (_section.ExternalControls) { _prevButton.SetActive(false); _nextButton.SetActive(false); } else { // Within bounds _prevButton.SetActive(_activeSection != 0); _nextButton.SetActive(_activeSection < _activeTutorial.TutorialSections.Length - 1); } _textObject.text = _section.Body; Vector3 doctorScale = _doctorObject.transform.localScale; if (_section.DoctorOnLeft) { doctorScale.x = -1; _doctorObject.transform.position = _doctorLeftWaypoint.transform.position; } else { _doctorObject.transform.position = _doctorRightWaypoint.transform.position; doctorScale.x = 1; } _doctorObject.transform.localScale = doctorScale; if (_section.ObjectReferenceID != String.Empty) { HighlightObject(_section.ObjectReferenceID, _section.HighlightType); } else { _UIHighlight.gameObject.SetActive(false); if (_objectHighlight != null) { Destroy(_objectHighlight); } } } else if (_activeTutorial.TutorialSections.Length == 0) { Debug.LogError("Tutorial has no sections... Closing"); TutorialSystem.Instance.DeactivateTutorial(); } else { throw new IndexOutOfRangeException(); } }
public TutorialPart LoadFile(int Location, string FileName) { TutorialObject tester = JsonUtility.FromJson <TutorialObject>(Resources.Load <TextAsset>(FileName).text); return(tester.Parts[Location]); }