123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- using SC.XR.Unity;
- using ShadowStudio.Model;
- using ShadowStudio.Tool;
- using Studio.Scripts;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using XRTool.Util;
- using XRTool.WorldUI;
- namespace ShadowStudio.UI
- {
- [RequireComponent(typeof(WorldDlg))]
- public class FileListDlg : UnitySingleton<FileListDlg>
- {
- //public TextMesh fileCountText;
- private Button clearyourBtn;
- private Button clearallBtn;
- private Button delete;
- private SCInputField senceNameInputField;
- private Button openModelEditDlgBtn;
- private Button showModelEditDlgBtn;
- private Button hideModelEditDlgBtn;
- private Button clearScenceNameBtn;
- public static ArtContainer artContainer;
- WorldDlg dlg;
- public static Action<ArtContainer,bool> ChooseFileAction;//选择文件的监听
- public static Action<string> ChooseSceneName;//选择显示场景的名字
- private string tempsenceName;
- private int click = 0;
- private DateTime lastClickTime;
- void Start()
- {
- dlg = GetComponent<WorldDlg>();
- //fileCountText = dlg.GetBreadthChild<TextMesh>("FileCountText");
- clearyourBtn = dlg.GetBreadthChild<Button>("ClearyourBtn");
- clearyourBtn.onClick.AddListener(OnClickClearyour);
- clearallBtn = dlg.GetBreadthChild<Button>("ClearallBtn");
- clearallBtn.onClick.AddListener(OnClickClearall);
- delete = dlg.GetBreadthChild<Button>("Delete");
- delete.onClick.AddListener(OnClickDelete);
- senceNameInputField = dlg.GetBreadthChild<SCInputField>("ScenceNameInputField");
- //senceNameInputField.onValueChanged.AddListener(SenceNameValueChange);
- senceNameInputField.onEndEdit.AddListener(SenceNameEndEdit);
- ChooseSceneName += ShowSceneName;
- hideModelEditDlgBtn = dlg.GetBreadthChild<Button>("HideModelEditDlgBtn");
- hideModelEditDlgBtn.onClick.AddListener(ClickOnHideModelEditDlg);
- showModelEditDlgBtn = dlg.GetBreadthChild<Button>("ShowModelEditDlgBtn");
- showModelEditDlgBtn.onClick.AddListener(ClickOnShowModelEditDlg);
- hideModelEditDlgBtn.gameObject.SetActive(false);
- showModelEditDlgBtn.gameObject.SetActive(false);
- ArtMoreEditor.Instance.gameObject.SetActive(false);
- if (CommonMethod.mySetting.Fmss == 1)
- {
- hideModelEditDlgBtn.gameObject.SetActive(true);
- ArtMoreEditor.Instance.gameObject.SetActive(true);
- }
- openModelEditDlgBtn = dlg.GetBreadthChild<Button>("OpenModelEditDlgBtn");
- openModelEditDlgBtn.onClick.AddListener(()=> {
- if (CommonMethod.mySetting.Fmss == 2)
- {
- DateTime now = DateTime.Now;
- // 两次点击间隔小于500毫秒时,算连续点击
- if ((now - lastClickTime).TotalMilliseconds <= 500)
- {
- click++;
- if (click >= 3)
- {
- click = 0;// 连续点击完毕时,清0
- if (ArtMoreEditor.Instance)
- {
- hideModelEditDlgBtn.gameObject.SetActive(true);
- ArtMoreEditor.Instance.gameObject.SetActive(true);
- CommonMethod.mySetting.Fmss = 1;
- if (HomeProxy.Instance)
- {
- HomeProxy.Instance.RequestUpdateSettings(CommonMethod.mySetting.Fmss);
- }
- }
- }
- }
- else
- {
- click = 0;// 不是连续点击时,清0
- }
- lastClickTime = now;
- }
- });
- }
- private void ClickOnShowModelEditDlg()
- {
- if (CommonMethod.mySetting.Fmss == 1)
- {
- hideModelEditDlgBtn.gameObject.SetActive(true);
- showModelEditDlgBtn.gameObject.SetActive(false);
- if (ArtMoreEditor.Instance)
- {
- ArtMoreEditor.Instance.gameObject.SetActive(true);
- }
- }
- }
- private void ClickOnHideModelEditDlg()
- {
- if (CommonMethod.mySetting.Fmss == 1)
- {
- hideModelEditDlgBtn.gameObject.SetActive(false);
- showModelEditDlgBtn.gameObject.SetActive(true);
- if (ArtMoreEditor.Instance)
- {
- ArtMoreEditor.Instance.gameObject.SetActive(false);
- }
- }
- }
- private void ShowSceneName(string sceneName)
- {
- senceNameInputField.text = sceneName;
- tempsenceName = sceneName;
- }
-
- //private void SenceNameValueChange(string sceneName)
- //{
-
- //}
- private void SenceNameEndEdit(string sceneName)
- {
- if (sceneName != "")
- {
- if (sceneName.Trim() != string.Empty)
- {
- if (sceneName.Length > 14)
- {
- senceNameInputField.text = tempsenceName;
- }
- else
- {
- WSHandler.Room.ChangeSceneName(CommonMethod.currentScene.Id, sceneName);
- }
- }
- else
- {
- senceNameInputField.text = tempsenceName;
- }
- }
- else
- {
- senceNameInputField.text = tempsenceName;
- }
- //clearScenceNameBtn.gameObject.SetActive(false);
- }
- private void OnClickDelete()
- {
- if (artContainer != null)
- {
- ItemFileList.Instance.DeleteFileIcon(artContainer);
- }
- }
- private void OnClickClearall()
- {
- //Debug.Log(CommonMethod.roomConfig.Is_created + "+++");
- if (CommonMethod.roomConfig.Is_created == "1")
- {
- DrawPener.Instance.ClearAllLine(true);
- }
- }
- private void OnClickClearyour()
- {
- DrawPener.Instance.ClearAllLine();
- }
- protected override void OnDestroy()
- {
- base.OnDestroy();
- ChooseSceneName -= ShowSceneName;
- }
- }
- }
|