private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } uiList = new Dictionary <string, GameObject>(); foreach (var item in all) { if (item.active) { GameObject obj = Instantiate(item.obj); uiList.Add(obj.name, obj.gameObject); obj.transform.SetParent(transform, false); obj.SetActive(!item.show); obj.SetActive(item.show); } } }
void Start() { scorePopList = new List <PopUI>(); for (int i = 0; i < 5; i++) { PopUI pop = Instantiate(scorePopPrefab, transform); scorePopList.Add(pop); pop.gameObject.SetActive(false); } }
public static void UserSave(string data) { if (liveViewerTools.SaveDatString(data, LiveViewerTools.PrefDataPath)) { } else { PopUI.ShowMessage(LogType.Error, "保存失败,可能是权限不足"); } }
IEnumerator Start() { buttonList[0].onClick.AddListener(OnOpenPlayer); buttonList[1].onClick.AddListener(OnOpenModel); PopUI.ShowMessage(LogType.Log, "读取文件中"); yield return(new WaitForSeconds(0.1f)); liveViewerTools.CopyFiles(); }
public void PopEnergy(int value, int total, Vector3 position) { UpdateScoreText(total); PopUI pop = GetListedPop(); if (pop != null) { pop.gameObject.SetActive(true); pop.PopIt(value, position); } }
private void OnSaveButton() { try { OnSave(input.text); Hide(); } catch (Exception e) { PopUI.ShowMessage(LogType.Exception, e.Message); } }
public static string UserLoad() { try { return(liveViewerTools.ReadDatString(LiveViewerTools.PrefDataPath)); } catch (Exception e) { Debug.LogException(e); PopUI.ShowMessage(LogType.Error, "读取失败,可能是权限不足"); return(null); } }
private bool CheckSaveModel(string text, string path) { try { var obj = JsonConvert.DeserializeObject(text); Program.liveViewerTools.SaveDatString(text, path); return(true); } catch (Exception e) { PopUI.ShowMessage(LogType.Exception, e.Message); } return(false); }
public void OnOpenModel() { if (FileBrowser.CheckPermission() == FileBrowser.Permission.Granted) { #if UNITY_EDITOR Directory.CreateDirectory(LiveViewerTools.EXT_PRESISTDATA_PATH); #endif FileBrowser.ShowLoadDialog(OnFileOpenSuccess, () => { }, false, LiveViewerTools.EXT_PRESISTDATA_PATH + "/save"); } else { PopUI.ShowMessage(LogType.Error, "请开启文件权限"); } }
void Start() { BtnLoad.onClickCustom = OnClickBtnLoad; BtnSave.onClickCustom = OnClickBtnSave; BtnNew.onClickCustom = OnClickBtnNew; if (popUI == null) { popUI = (GameObject.Instantiate(AssetDatabase.LoadAssetAtPath(EditorUIPrefabPath + "PopUI.prefab", typeof(GameObject))) as GameObject).GetComponent <PopUI>(); popUI.transform.SetParent(NodeContainer); popUI.transform.GetComponent <RectTransform>().localScale = Vector3.one; popUI.editorUI = this; popUI.gameObject.SetActive(false); } }
public void OnOpenPlayer() { if (Program.UserCheck()) { PrefData player = Program.UserLoad(); if (player == null) { PopUI.ShowMessage(LogType.Error, "读取失败"); } string data = JsonConvert.SerializeObject(player); data = LiveViewerTools.ConvertJsonString(data); EditorUi.SetText(data); EditorUi.OnSave = OnUserSave; } else { PopUI.ShowMessage(LogType.Error, "没有Root权限或文件不存在"); } }
private bool OnUserSave(string arg) { PrefData player; try { player = JsonConvert.DeserializeObject <PrefData>(arg); } catch (Exception e) { PopUI.ShowMessage(LogType.Exception, e.Message); return(false); } if (player != null) { return(Program.UserSave(player)); } return(false); }
public void OnOpenPlayer() { //liveViewerTools.CopyFiles(); //if (UserCheck()) //{ string data = UserLoad(); if (data == null) { PopUI.ShowMessage(LogType.Error, "读取失败"); return; } //data = LiveViewerTools.PrittyJsonString(data); EditorUi.SetText(data); EditorUi.OnSave = UserSave; //} //else //{ // PopUI.ShowMessage(LogType.Error, "没有Root权限或文件不存在"); //} }
PopUI GetListedPop() { PopUI pop = null; if (scorePopList != null) { foreach (PopUI pp in scorePopList) { if (!pp.bActive) { pop = pp; break; } } if (pop == null) { PopUI popper = Instantiate(scorePopPrefab, transform); pop = popper; } } return(pop); }
// Use this for initialization void Start() { instance = this; Hide(); }