add
This commit is contained in:
77
Assets/trCRM/Editor/EMyUIPanel.cs
Normal file
77
Assets/trCRM/Editor/EMyUIPanel.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Coolape;
|
||||
using System.IO;
|
||||
|
||||
[CustomEditor(typeof(MyUIPanel), true)]
|
||||
public class EMyUIPanel : CLPanelLuaInspector
|
||||
{
|
||||
private MyUIPanel instance;
|
||||
string title = "";
|
||||
bool isFinishInited = false;
|
||||
void init()
|
||||
{
|
||||
if (isFinishInited) return;
|
||||
isFinishInited = true;
|
||||
instance = target as MyUIPanel;
|
||||
string language = "Chinese";
|
||||
if (!Localization.language.Equals(language))
|
||||
{
|
||||
byte[] buff = null;
|
||||
string languageFile = PStr.b(
|
||||
CLPathCfg.self.localizationPath,
|
||||
language, ".txt").e();
|
||||
#if UNITY_EDITOR
|
||||
if (CLCfgBase.self.isEditMode)
|
||||
{
|
||||
languageFile = PStr.b().a(CLPathCfg.persistentDataPath).a("/").a(languageFile).e();
|
||||
languageFile = languageFile.Replace("/upgradeRes/", "/upgradeRes4Dev/");
|
||||
buff = File.ReadAllBytes(languageFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
buff = FileEx.readNewAllBytes(languageFile);
|
||||
}
|
||||
#else
|
||||
buff = FileEx.readNewAllBytes(languageFile);
|
||||
#endif
|
||||
Localization.Load(language, buff);
|
||||
}
|
||||
title = Localization.Get(instance.titleKeyName);
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
init();
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
EditorGUILayout.LabelField("页面Title", ECLEditorUtl.width80);
|
||||
title = EditorGUILayout.TextField(title);
|
||||
|
||||
#region add by chenbin
|
||||
if (GUILayout.Button("Select"))
|
||||
{
|
||||
ECLLocalizeSelection.open((ECLLocalizeSelection.OnSlecteCallback)OnSlecteLocalize);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
{
|
||||
EditorGUILayout.LabelField("页面Title Key", ECLEditorUtl.width80);
|
||||
instance.titleKeyName = EditorGUILayout.TextField(instance.titleKeyName);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
|
||||
public void OnSlecteLocalize(string key, string val)
|
||||
{
|
||||
instance.titleKeyName = key;
|
||||
title = val;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/trCRM/Editor/EMyUIPanel.cs.meta
Normal file
11
Assets/trCRM/Editor/EMyUIPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81c1d68871ec647d59f1361be97527b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Assets/trCRM/Editor/ETrcrmMenus.cs
Normal file
13
Assets/trCRM/Editor/ETrcrmMenus.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
public class ETrcrmMenus
|
||||
{
|
||||
|
||||
[MenuItem("Assets/Create/Lua Script/New Class Lua Panel", false, 81)]
|
||||
public static void CreatNewLuaPanel()
|
||||
{
|
||||
ECLCreateFile.PubCreatNewFile("Assets/trCRM/Templates/Lua/NewClassLuaPanel.lua", ECLCreateFile.GetSelectedPathOrFallback() + "/NewLuaPanel.lua");
|
||||
}
|
||||
}
|
||||
11
Assets/trCRM/Editor/ETrcrmMenus.cs.meta
Normal file
11
Assets/trCRM/Editor/ETrcrmMenus.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c5654ee4cf414a2e849e1f88f846006
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user