public void AccomplishTarget(int index) { targetObject[index].GetComponent <Image>().color = new Color(0.19f, 1, 0.063f, 0.39f); Level.levelScene nowLevel = GameObject.Find("MainScreenObject").GetComponent <Level>().nowLevel; GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("target_accomplished", "{level:'" + nowLevel + "'" + ", target:'" + (index + 1) + "', target_content:'" + targets[index] + "' }"); }
// Start is called before the first frame update void Start() { leftButton.onClick.AddListener(delegate { PrePage(); } ); rightButton.onClick.AddListener(delegate { NextPage(); } ); pageText.text = (nowPage + 1) + "/" + count; dialougeString = dialouge[nowPage]; if (sprites[nowPage]) { image.sprite = sprites[nowPage]; } waitEnd = true; GameObject tipsObject = gameObject; dialougeText.text = ""; image.enabled = false; GameSystemManager.GetSystem <TimerManager>().Add(new Timer(4, TipsStart, null)); }
protected void setUp() { nowLevel = nextLevel; nowLevel--; if (nextLevel == levelScene.Level1) { nowLevel = levelScene.Level0; } nextLevelButton.onClick.AddListener(delegate { restartCount = 0; GameSystemManager.GetSystem <SceneStateManager>().LoadSceneState(new LoadSceneState("MainSceneState", nextLevel + "Scene"), true); }); restartLevelButton.onClick.AddListener(delegate { restartCount++; GameSystemManager.GetSystem <SceneStateManager>().LoadSceneState(new LoadSceneState("MainSceneState", nowLevel + "Scene"), true); GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("level_restart", "{level:'" + nowLevel + "'}"); }); returnTitleButton.onClick.AddListener(delegate { restartCount = 0; GameSystemManager.GetSystem <SceneStateManager>().LoadSceneState(new LoadSceneState("MainSceneState", "TitleScene"), true); GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("level_quit", "{level:'" + nowLevel + "'}"); }); if (GameSystemManager.GetSystem <StudentEventManager>()) { GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("level_start", "{level:'" + nowLevel + "'}"); } levelCost = 0; passedLevel = false; levelStarted = true; }
public bool Pull(string remote, string branch) { if (remotes.Contains(remote)) { if (serverRepository.hasBranch(branch)) { confilctFiles = new List <string>(); //Debug.Log(serverRepository.nowBranch.nowCommit.allFiles.Count + " : " + modifiedFiles.Count); for (int i = 0; i < serverRepository.nowBranch.nowCommit.allFiles.Count; i++) { for (int j = 0; j < modifiedFiles.Count; j++) { //Debug.Log(serverRepository.nowBranch.nowCommit.allFiles[i].Key + " : " + modifiedFiles[j].Key); if (serverRepository.nowBranch.nowCommit.allFiles[i].Key == modifiedFiles[j].Key) { //Debug.Log("Conflicted: " + modifiedFiles[j].Key); confilctFiles.Add(modifiedFiles[j].Key); } } } if (confilctFiles.Count > 0) { conflicted = true; GameSystemManager.GetSystem <PanelManager>().AddSubPanel(conflictSystem); conflictSystem.OpenConflict(confilctFiles, modifiedFiles, serverRepository.nowBranch.nowCommit.allFiles, false, ""); conflictSystem.gameObject.SetActive(true); } return(true); } } return(false); }
private void Start() { consoleCanvas.gameObject.SetActive(true); //GameSystemManager.AddSystem<DeveloperConsole>(gameObject); CreateCommands(); GameSystemManager.GetSystem <PanelManager>().AddSubPanel(this); }
private void OnGUI() { if (GameSystemManager.GetSystem <ScreenEffect>().screen_covered) { DrawAnimation(); } }
public void Commit() { if (hasRepository() && !conflicted) { gitFileObject.SetActive(true); GameSystemManager.GetSystem <PanelManager>().AddSubPanel(this); } }
public void LoadSceneState(SceneState state, bool immediately = true) { if (_scene_next == null) { _scene_next = state; GameSystemManager.GetSystem <AudioManager>().FadeOutBgm(1); GameSystemManager.GetSystem <ScreenEffect>().FadeInBlack(1.5f); this.immediately = immediately; } }
public void TipsStart(object obj) { startDialouge = true; image.enabled = true; // achieve 10 if (Level.restartCount == 10) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(10)); } }
private void OnEnable() { if (!nowLevel) { nowLevel = GameObject.Find("MainScreenObject").GetComponent <Level>(); } if (nowLevel.levelStarted) { GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("tips_opened", "{}"); } }
public override void StateUpdate() { // Fading in Loading background if (GameSystemManager.GetSystem <ScreenEffect>().screen_covered) { if (!GameSystemManager.GetSystem <ScreenEffect>().fading&& GameSystemManager.GetSystem <ScreenEffect>().count == 1) { GameSystemManager.GetSystem <ScreenEffect>().FadeIn(1.5f, GameSystemManager.GetSystem <ScreenEffect>().back[0]); } } }
public void LoadTargetScene(object obj) { if (load_state == "MainSceneState") { GameSystemManager.GetSystem <SceneStateManager>().LoadSceneState(new MainSceneState(load_state, load_scene)); } else if (load_state == "TitleSceneState") { GameSystemManager.GetSystem <SceneStateManager>().LoadSceneState(new TitleSceneState(load_state, load_scene)); } }
public override void StateExit() { if (GameSystemManager.GetSystem <SceneStateManager>().scene_now.switchfinished) { GameSystemManager.GetSystem <ScreenEffect>().FadeOut(2, 2); GameSystemManager.GetSystem <TimerManager>().Add(new Timer(1.5f, LoadFadeOut, 2)); } else { GameSystemManager.GetSystem <TimerManager>().Add(new Timer(0.25f, LoadFadeOut, 2)); } }
public void PanelInput() { if ((Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))) { if (gitInputField.GetComponent <InputField>().text == "!wq") { Commit(fileInputField.GetComponent <InputField>().text); gitFileObject.SetActive(false); GameSystemManager.GetSystem <PanelManager>().ReturnTopPanel(); } //Commit(gitInputField.); } }
public void logout() { GameSystemManager.GetSystem<StudentEventManager>().logout(); loginStatus.text = "µn¤Jª¬ºA¡G¤wµn¥X"; startButton.interactable = false; chapterButton.interactable = false; achievementButton.interactable = false; loginButton.GetComponentInChildren<Text>().text = "µn¤J±b¸¹"; loginButton.onClick.RemoveAllListeners(); loginButton.onClick.AddListener(loginDialogueShow); username.text = ""; password.text = ""; }
public override void RunCommand(string[] param) { if (param.Length != 2) { GameSystemManager.GetSystem <DeveloperConsole>().AddMessageToConsole("Error format"); } else { bool end = GameObject.Find("FileObject").GetComponent <FileSystem>().DeleteFile(param[1]); if (!end) { GameSystemManager.GetSystem <DeveloperConsole>().AddMessageToConsole("Cannot find file"); } } }
public IEnumerator logLevelRecord(int timeCost, int lineCost, int level) { WWWForm form = new WWWForm(); form.AddField("username", GameSystemManager.GetSystem <StudentEventManager>().username); form.AddField("timeCost", timeCost); form.AddField("lineCost", lineCost); form.AddField("level", level); using (UnityWebRequest www = UnityWebRequest.Post(logLevelRecordApi, form)) { yield return(www.SendWebRequest()); } }
private void Start() { loginButton.onClick.AddListener(loginDialogueShow); if (GameSystemManager.GetSystem<StudentEventManager>().isLogin) { loginStatus.text = "µn¤Jª¬ºA¡Gµn¤J¦¨¥\"; loginButton.GetComponentInChildren<Text>().text = "µn¥X±b¸¹"; startButton.interactable = true; chapterButton.interactable = true; achievementButton.interactable = true; loginButton.onClick.RemoveAllListeners(); loginButton.onClick.AddListener(logout); } }
// 讀取畫面圖片淡出 public void LoadFadeOut(object obj) { int fade_index = (int)obj; if (fade_index == 0 && GameSystemManager.GetSystem <ScreenEffect>().count == 1) { GameSystemManager.GetSystem <ScreenEffect>().FadeOut(1.5f, 0); } else { if (!GameSystemManager.GetSystem <ScreenEffect>().fading) { GameSystemManager.GetSystem <ScreenEffect>().FadeOut(1.5f, 2); } GameSystemManager.GetSystem <TimerManager>().Add(new Timer(1.5f, LoadFadeOut, 0)); } }
public void ChangeSceneState() { if (_scene_next != null && GameSystemManager.GetSystem <ScreenEffect>().screen_covered) { _scene_next.ChangeScene(); _scene_pre = _scene_now; _scene_now = _scene_next; _scene_next = null; _scene_now.StateStart(); progress = 0; loading = false; if (_scene_pre != null) { _scene_pre.StateExit(); } } }
public void PanelInput() { //Cursor.visible = consoleCanvas.gameObject.activeInHierarchy; if (consoleCanvas.gameObject.activeInHierarchy) { if ((Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return))) { if (inputText.text != "") { AddMessageToConsole(inputText.text); if (inputLogs.Count == 0 || inputText.text != inputLogs[inputLogs.Count - 1]) { inputLogs.Add(inputText.text); } if (GameSystemManager.GetSystem <StudentEventManager>()) { GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("console_input", "{input:'" + inputText.text + "'}"); } ParseInput(inputText.text); consoleInput.text = ""; consoleInput.ActivateInputField(); inputIndex = inputLogs.Count; } } if (Input.GetKeyDown(KeyCode.UpArrow)) { if (inputIndex > 0) { inputIndex--; consoleInput.text = inputLogs[inputIndex]; consoleCanvas.GetComponentInChildren <InputField>().MoveTextEnd(false); } } if (Input.GetKeyDown(KeyCode.DownArrow)) { if (inputIndex < inputLogs.Count - 1) { inputIndex++; consoleInput.text = inputLogs[inputIndex]; consoleCanvas.GetComponentInChildren <InputField>().MoveTextEnd(false); } } } }
IEnumerator achievementSet() { // achieve 1 if (nowLevel == levelScene.Level1) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(1)); } // achieve 2 if (nowLevel == levelScene.Level5) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(2)); } // achieve 3 if (nowLevel == levelScene.Level9) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(3)); } // achieve 7 if (nowLevel != levelScene.Level0 && levelCost < 30) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(7)); } int levelInteger = (int)nowLevel + 1; if (nowLevel == levelScene.Level0) { levelInteger = 0; } // log level record yield return(StartCoroutine(GameSystemManager.GetSystem <LeaderBoard>().logLevelRecord((int)levelCost, costLines, levelInteger))); // achieve 4 using (UnityWebRequest www = UnityWebRequest.Get(GameSystemManager.GetSystem <LeaderBoard>().getLeaderBoardApi() + "?level=" + levelInteger)) { yield return(www.SendWebRequest()); string jsonString = JsonHelper.fixJson(www.downloadHandler.text); LeaderBoard.LevelRecord[] leaderboardRecords = JsonHelper.FromJson <LeaderBoard.LevelRecord>(jsonString); if (leaderboardRecords[0].username == GameSystemManager.GetSystem <StudentEventManager>().username&& levelInteger != 0) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(4)); } } }
// Use this for initialization void Start() { if (!GameSystemManager.GetSystem <ScreenEffect>()) { GameSystemManager.AddSystem <ScreenEffect>(Instantiate(_prefab[0])); } if (!GameSystemManager.GetSystem <StudentEventManager>()) { GameSystemManager.AddSystem <StudentEventManager>(Instantiate(_prefab[1])); } if (!GameSystemManager.GetSystem <LeaderBoard>()) { GameSystemManager.AddSystem <LeaderBoard>(Instantiate(_prefab[2])); } if (!GameSystemManager.GetSystem <AchievementManager>()) { GameSystemManager.AddSystem <AchievementManager>(Instantiate(_prefab[3])); } }
// Update is called once per frame void Update() { if (testSwitch) { popup(); testSwitch = false; } if (popuping) { if (transform.localPosition.y >= topPos) { transform.localPosition = new Vector3(transform.localPosition.x, topPos, transform.localPosition.z); popuping = false; GameSystemManager.GetSystem <TimerManager>().Add(new Timer(stopTime, hide)); } else { transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y + Time.deltaTime * speed, transform.localPosition.z); } } if (hiding) { if (transform.localPosition.y <= bottomPos) { transform.localPosition = new Vector3(transform.localPosition.x, bottomPos, transform.localPosition.z); hiding = false; animationPlaying = false; iconQueue.RemoveAt(0); descriptionQueue.RemoveAt(0); if (iconQueue.Count != 0) { this.icon.sprite = iconQueue[0]; this.description.text = descriptionQueue[0]; popup(); } } else { transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y + Time.deltaTime * -speed, transform.localPosition.z); } } }
IEnumerator loginAuth() { WWWForm form = new WWWForm(); if (username.text.Equals("") || password.text.Equals("")) { loginStatus.text = "µn¤Jª¬ºA¡G±K½X¿ù»~©Î±b¸¹¤£¦s¦b"; yield return null; } else { form.AddField("username", username.text); form.AddField("password", password.text); using (UnityWebRequest www = UnityWebRequest.Post(loginApi, form)) { yield return www.SendWebRequest(); //Debug.Log(www.result.ToString()); loginJson loginResult = JsonUtility.FromJson<loginJson>(www.downloadHandler.text); if (loginResult.status) { loginStatus.text = "µn¤Jª¬ºA¡Gµn¤J¦¨¥\"; loginButton.GetComponentInChildren<Text>().text = "µn¥X±b¸¹"; startButton.interactable = true; chapterButton.interactable = true; loginDialogue.SetActive(false); GameSystemManager.GetSystem<StudentEventManager>().setJwtToken(loginResult.token); GameSystemManager.GetSystem<StudentEventManager>().setUsername(username.text); loginButton.onClick.RemoveAllListeners(); loginButton.onClick.AddListener(logout); achievementButton.interactable = true; } else { loginStatus.text = "µn¤Jª¬ºA¡G±K½X¿ù»~©Î±b¸¹¤£¦s¦b"; } //token.text = www.downloadHandler.text; //Debug.Log(token.text); } } }
public bool Merge(string branchName) { if (!localRepository.hasBranch(branchName)) { return(false); } // if conflict confilctFiles = new List <string>(); Branch branch = localRepository.branches.Find(x => x.branchName == branchName); for (int i = 0; i < branch.nowCommit.allFiles.Count; i++) { for (int j = 0; j < localRepository.nowBranch.nowCommit.allFiles.Count; j++) { //Debug.Log(serverRepository.nowBranch.nowCommit.allFiles[i].Key + " : " + modifiedFiles[j].Key); if (branch.nowCommit.allFiles[i].Key == localRepository.nowBranch.nowCommit.allFiles[j].Key) { if (branch.nowCommit.allFiles[i].Value != localRepository.nowBranch.nowCommit.allFiles[j].Value) { Debug.Log("Conflicted: " + localRepository.nowBranch.nowCommit.allFiles[j].Key); Debug.Log(localRepository.nowBranch.nowCommit.allFiles[j].Value + " : " + branch.nowCommit.allFiles[i].Value); confilctFiles.Add(localRepository.nowBranch.nowCommit.allFiles[j].Key); } } } } if (confilctFiles.Count > 0) { conflicted = true; conflictSystem.OpenConflict(confilctFiles, localRepository.nowBranch.nowCommit.allFiles, branch.nowCommit.allFiles, true, branchName); GameSystemManager.GetSystem <PanelManager>().AddSubPanel(conflictSystem); conflictSystem.gameObject.SetActive(true); } else { Commit("Merge branch " + branchName); nowCommit.transform.GetChild(2).gameObject.SetActive(true); } return(true); }
private void OnDisable() { if (nowLevel.levelStarted) { GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("tips_closed", "{}"); } // achieve 9 if (nowPage == 0) { GameSystemManager.GetSystem <AchievementManager>().logAchievementByManager(9); } nowPage = 0; pageText.text = (nowPage + 1) + "/" + count; image.color = new Color(1, 1, 1, 0); dialougeString = dialouge[nowPage]; if (sprites[nowPage]) { image.sprite = sprites[nowPage]; } dialougeStringIndex = 0; waitEnd = true; }
public IEnumerator logAchievement(int achievementId) { WWWForm form = new WWWForm(); form.AddField("username", GameSystemManager.GetSystem <StudentEventManager>().username); string achievement = "{ id:" + (achievementId) + "}"; form.AddField("achievement", achievement); using (UnityWebRequest www = UnityWebRequest.Post(logAchievementApi, form)) { yield return(www.SendWebRequest()); string result = www.downloadHandler.text; if (!result.Equals("already have achievement")) { achieve(achievementId, DateTime.Now.ToString()); } } }
protected void updateTarget() { if (!targetSystem.targetStatus.Contains(false) && !passedLevel) { passedLevelTips.SetActive(true); passedLevel = true; if (nowLevel != levelScene.Level0) { costLines = GameObject.Find("DeveloperConsoleObject").GetComponent <Console.DeveloperConsole>().inputLogs.Count; passedLevelTips.transform.GetChild(0).GetChild(0).GetChild(1).GetComponent <Text>().text = "您使用了" + costLines + "行指令\n" + "並花費" + (int)levelCost + "秒通關"; } GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("level_passed", "{level:'" + nowLevel + "'" + ", line_cost:'" + costLines + "', time_cost:'" + (int)levelCost + "' }"); StartCoroutine(achievementSet()); } else if (!passedLevel) { passedLevelTips.SetActive(false); passedLevel = false; } }
public void OnPointerExit(PointerEventData eventData) { covered = false; if (reading) { Level.levelScene nowLevel = GameObject.Find("MainScreenObject").GetComponent <Level>().nowLevel; GameSystemManager.GetSystem <StudentEventManager>().logStudentEvent("card_read", "{level:'" + nowLevel + "'" + ", card:'" + title.text + "'}"); readTimes++; allReadTimes++; // achieve 5 if (readTimes == 5) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(5)); } // achieve 6 if (allReadTimes == 25) { StartCoroutine(GameSystemManager.GetSystem <AchievementManager>().logAchievement(6)); } reading = false; } }