Пример #1
0
    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);
            }
        }
    }
Пример #2
0
 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);
     }
 }
Пример #3
0
 public static void UserSave(string data)
 {
     if (liveViewerTools.SaveDatString(data, LiveViewerTools.PrefDataPath))
     {
     }
     else
     {
         PopUI.ShowMessage(LogType.Error, "保存失败,可能是权限不足");
     }
 }
Пример #4
0
    IEnumerator Start()
    {
        buttonList[0].onClick.AddListener(OnOpenPlayer);
        buttonList[1].onClick.AddListener(OnOpenModel);

        PopUI.ShowMessage(LogType.Log, "读取文件中");
        yield return(new WaitForSeconds(0.1f));

        liveViewerTools.CopyFiles();
    }
Пример #5
0
    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);
        }
    }
Пример #6
0
 private void OnSaveButton()
 {
     try
     {
         OnSave(input.text);
         Hide();
     }
     catch (Exception e)
     {
         PopUI.ShowMessage(LogType.Exception, e.Message);
     }
 }
Пример #7
0
 public static string UserLoad()
 {
     try
     {
         return(liveViewerTools.ReadDatString(LiveViewerTools.PrefDataPath));
     }
     catch (Exception e)
     {
         Debug.LogException(e);
         PopUI.ShowMessage(LogType.Error, "读取失败,可能是权限不足");
         return(null);
     }
 }
Пример #8
0
 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);
 }
Пример #9
0
    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, "请开启文件权限");
        }
    }
Пример #10
0
    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);
        }
    }
Пример #11
0
 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权限或文件不存在");
     }
 }
Пример #12
0
    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);
    }
Пример #13
0
    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权限或文件不存在");
        //}
    }
Пример #14
0
    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);
    }
Пример #15
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     Hide();
 }