static void SaveGameJSON(SaveDisplay saveDisplay) { var JsonSavePath = Application.persistentDataPath + String.Format("/{0}_DEBUG_save.JSON", GetDateTimeString()); string json = JsonUtility.ToJson(saveDisplay, true); File.WriteAllText(JsonSavePath, json); }
protected override void OnClick() { SaveDisplay display = GetComponentInParent <SaveDisplay>(); //remove the directory through the gamesaver GameSaver.FolderNumber = display.saveNumber; GameSaver.RemoveDirectory(); display.Refresh(); //refresh the display }
private void Start() { //Assign singleton main = this; //Assign instances and set to defualt states openButtonText = transform.parent.Find("Open").Find("Text").GetComponent <Text>(); openPanel = transform.Find("OpenPanel").gameObject; openPanel.SetActive(false); deletePanel = transform.Find("DeletePanel").gameObject; deletePanel.SetActive(false); //Get each asspect of each display section and store in an array for (int i = 0; i < 6; i++) { buttons[i] = transform.Find("OpenPanel").Find("Options").Find("Option " + (i + 1)).Find("Button").GetComponent <Button>(); deleteButtons[i] = transform.Find("OpenPanel").Find("Options").Find("Option " + (i + 1)).Find("Delete").GetComponent <Button>(); loadButtons[i] = transform.Find("OpenPanel").Find("Options").Find("Option " + (i + 1)).Find("Load").GetComponent <Button>(); } //Assign method to each button buttons[0].onClick.AddListener(() => ActiveGridPlacement(1)); buttons[1].onClick.AddListener(() => ActiveGridPlacement(2)); buttons[2].onClick.AddListener(() => ActiveGridPlacement(3)); buttons[3].onClick.AddListener(() => ActiveGridPlacement(4)); buttons[4].onClick.AddListener(() => ActiveGridPlacement(5)); buttons[5].onClick.AddListener(() => ActiveGridPlacement(6)); //Get each arrow rightArrow = transform.Find("OpenPanel").Find("Right").gameObject; leftArrow = transform.Find("OpenPanel").Find("Left").gameObject; //Retrieve from save LoadFromFile(); //Display each grid RenderOptions(); }