public static T GetData(string key) { if (key == null) { throw new Exception("DataGenerateManager<" + typeof(T).Name + "> GetData key is Null !"); } //清理缓存 if (!s_isInit) { s_isInit = true; GlobalEvent.AddEvent(MemoryEvent.FreeHeapMemory, CleanCatch); } if (s_dict.ContainsKey(key)) { return(s_dict[key]); } else { T data = new T(); data.LoadData(key); s_dict.Add(key, data); return(data); } }
bool NewMapFileGUI() { GUILayout.BeginHorizontal("box"); newFileName = EditorDrawGUIUtil.DrawBaseValue("新建地图文件", newFileName).ToString(); if (GUILayout.Button("确定", GUILayout.Width(50))) { if (ResourcePathManager.ContainsFileName(newFileName)) { EditorUtility.DisplayDialog("错误", "文件名与其他文件重复", "OK"); return(true); } MapInfomation info = new MapInfomation(); info.id = GetMaxID() + 1; //info.sceneName = "Scene_" + newFileName; info.mapFileName = MapUseConstValues.MapFileNamePrefix + newFileName; MapManager.MapInfosDic.Add(info.id, info); GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) => { Initialize(); }, true); SaveMapInfoData(); FileUtils.CreateTextFile(MapUseConstValues.MapDataDirectory + info.mapFileName + "/" + info.mapFileName + ".txt", ""); AssetDatabase.Refresh(); return(false); } GUILayout.EndHorizontal(); return(true); }
protected override void OnStart() { base.OnStart(); GlobalEvent.AddEvent("BookCaseDown", HandleBookCaseDown); GlobalEvent.AddEvent("BookCaseUp", HandleBookCaseUp); }
public override void OnCreate() { ResetLOD(RenderManager.LOD); GlobalEvent.AddEvent(RenderEventEnum.UpdateLOD, ReceviceUpdateLOD); //Debug.Log("OnCreate " + (RenderManager.LOD)); }
protected override void OnStart() { base.OnStart(); m_aintAttack.gameObject.SetActive(false); GlobalEvent.AddEvent("Box_Opened", HandleBlockHoleOpened); }
//UI的初始化请放在这里 public override void OnOpen() { GlobalEvent.AddEvent(GameEventEnum.QuestionChange, UpdateQuestion); GlobalEvent.AddEvent(GameEventEnum.CreateSpace, AddSpace); GlobalEvent.AddEvent(GameEventEnum.NextPoem, NewPoem); GlobalEvent.AddEvent(GameEventEnum.ScoreChange, ChangeScore); GlobalEvent.AddEvent(GameEventEnum.HpChange, ChangeHP); GlobalEvent.AddEvent(GameEventEnum.ShowScoreLevel, ShowScoreLevel); AddOnClickListener("Button_answer1", OnClickAnswer, "1"); AddOnClickListener("Button_answer2", OnClickAnswer, "2"); AddOnClickListener("Button_answer3", OnClickAnswer, "3"); AddOnClickListener("Button_answer4", OnClickAnswer, "4"); if (GameLogic.s_GameModel == GameModel.Arcade) { SetActive("Text_score", true); SetActive("Text_HP", true); ChangeHP(); ChangeScore(); } else { SetActive("Text_score", false); SetActive("Text_HP", false); } }
public override void OnInit() { base.OnInit(); GlobalEvent.AddEvent(LanguageEventEnum.LanguageChange, ReceviceLanguageChange); GlobalEvent.AddEvent(GameOptionEventEnum.PoemLibChange, RecevicePoemOptionChange); AddOnClickListener("layout", OnClickItem); }
public void AddEventListener(Enum l_Event) { if (!m_EventNames.Contains(l_Event)) { m_EventNames.Add(l_Event); GlobalEvent.AddEvent(l_Event, Refresh); } }
protected override void OnStart() { base.OnStart(); m_animator = GetComponent <Animator>(); GlobalEvent.AddEvent("Cellar_Open", HandleCellarOpen); }
protected override void OnStart() { base.OnStart(); m_moveDistance = (4.47f - 4.14f) / m_dropDownTime; GlobalEvent.AddEvent("WeightDropDown", HandleWeightDropDown); }
public void AddEventListener(Enum EventEnum, EventHandle handle) { EventHandRegisterInfo info = new EventHandRegisterInfo(); info.m_EventKey = EventEnum; info.m_hande = handle; GlobalEvent.AddEvent(EventEnum, handle); m_EventListeners.Add(info); }
private void OnEnable() { if (editor == null) { editor = new TableDataEditor(); } editor.Init(this); GlobalEvent.AddEvent(EditorEvent.LanguageDataEditorChange, Refresh); }
void Start() { if (m_text == null) { m_text = GetComponent <Text>(); } ResetLanguage(); GlobalEvent.AddEvent(LanguageEventEnum.LanguageChange, ReceviceLanguageChange); }
private void Start() { GlobalEvent.Init(); GlobalEvent.AddEvent(GameEnums.Hello, Say_Hello_A); GlobalEvent.DispatchEvent(GameEnums.Hello, "1", "2", "3", "4"); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); }
void OnEnable() { EditorGUIStyleData.Init(); GlobalEvent.AddTypeEvent <SyncEntityMsg>(ReceviceSyncEntity); GlobalEvent.AddTypeEvent <PursueMsg>(RecevicePursueMsg); GlobalEvent.AddTypeEvent <ChangeSingletonComponentMsg>(ReceviceChangeSingletonCompMsg); GlobalEvent.AddTypeEvent <StartSyncMsg>(ReceviceStartSyncMsg); GlobalEvent.AddTypeEvent <AffirmMsg>(ReceviceAffirmMsg); GlobalEvent.AddTypeEvent <CommandComponent>(ReceviceCommandMsg); GlobalEvent.AddEvent(SyncDebugSystem.c_isAllMessage, ReceviceAllMsg); GlobalEvent.AddEvent(SyncDebugSystem.c_isConflict, ReceviceConflict); GlobalEvent.AddEvent(SyncDebugSystem.c_Recalc, ReceviceRecalc); }
private void CreateUI(string UIName) { isCreating = true; GlobalEvent.AddEvent(EditorGlobalEventEnum.OnCreateAsset, (param) => { Debug.Log("OnCreateAsset"); isCtreatingPrefab = true; showProgressContent = "创建预制"; progress = 0.5f; }, true); CreateUIScript(UIName); showProgressContent = "创建脚本"; progress = 0.25f; }
/// <summary> /// 全查表 /// </summary> public static void PreLoad() { //清理缓存 if (!s_isInit) { s_isInit = true; GlobalEvent.AddEvent(MemoryEvent.FreeHeapMemory, CleanCache); } DataTable data = GetDataTable(); for (int i = 0; i < data.TableIDs.Count; i++) { GetData(data.TableIDs[i]); } }
/// <summary> /// 全查表 /// </summary> public static void PreLoad() { //清理缓存 if (!s_isInit) { s_isInit = true; GlobalEvent.AddEvent(MemoryEvent.FreeHeapMemory, CleanCatch); } string dataName = typeof(T).Name.Replace("Generate", ""); DataTable data = DataManager.GetData(dataName); for (int i = 0; i < data.TableIDs.Count; i++) { GetData(data.TableIDs[i]); } }
public override void Init() { m_SDKName = "PublicPayClass"; storeName = (StoreName)Enum.Parse(typeof(StoreName), SDKManager.GetProperties(SDKInterfaceDefine.PropertiesKey_StoreName, "None")); //有其他的payClass符合就不启动public pay if (!SDKManager.GetHasPayService(storeName.ToString())) { GlobalEvent.AddTypeEvent <PrePay2Client>(OnPrePay); Debug.Log("PublicPayClass Init m_SDKName:>" + m_SDKName + "<"); } GlobalEvent.AddEvent(StoreName.WX, null); //GlobalEvent.DispatchEvent("Fight",) GlobalEvent.DispatchTypeEvent <InputUIOnClickEvent>(null); GlobalEvent.AddTypeEvent <InputUIOnClickEvent>((e, objs) => { }); SDKManager.GoodsInfoCallBack += OnGoodsInfoCallBack; }
private void Start() { //init GlobalEvent.Init(); //dispatch string GlobalEvent.AddEvent(GameEnums.Hello, Say_Hello_A); GlobalEvent.DispatchEvent(GameEnums.Hello, "Hello!"); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); //dispathc class GlobalEvent.AddEvent(GameEnums.Hello, Say_Hello_B); GlobalEvent.DispatchEvent(GameEnums.Hello, EventData.New(new Dictionary <string, object> { { "pos", Vector2.zero }, { "id", 120 } })); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_B); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); GlobalEvent.RemoveEvent(GameEnums.Hello, Say_Hello_A); }
void Start() { UpdateOffset(); GlobalEvent.AddEvent("ShakeCamera", ShakeCamera); }
private void NewTableConfig() { GUILayout.BeginHorizontal("box"); newFileName = EditorDrawGUIUtil.DrawBaseValue("新建配置文件:", newFileName).ToString(); if (GUILayout.Button("确定", GUILayout.Width(50))) { if (ResourcePathManager.ContainsFileName(newFileName) || string.IsNullOrEmpty(newFileName)) { EditorUtility.DisplayDialog("警告", "名字不能为空或重复", "OK"); } else { chooseFileName = newFileName; fileNames.Add(newFileName); } } GUILayout.EndHorizontal(); if (string.IsNullOrEmpty(newFileName)) { return; } if (ResourcePathManager.ContainsFileName(newFileName)) { EditorGUILayout.HelpBox("文件名重复!!", MessageType.Error); return; } if (newConfigInfo == null) { newConfigInfo = new TableConfigOtherInfo(); } newConfigInfo.configDescription = EditorDrawGUIUtil.DrawBaseValue("配置文件描述:", newConfigInfo.configDescription).ToString(); GUILayout.Space(5); GUILayout.BeginHorizontal("box"); GUILayout.Box("添加字段:"); GUILayout.FlexibleSpace(); if (GUILayout.Button("+", GUILayout.Width(50))) { TableConfigFieldInfo f = new TableConfigFieldInfo(); f.fieldName = "NewField" + newConfigInfo.fieldInfoDic.Count; while (newConfigInfo.fieldInfoDic.ContainsKey(f.fieldName)) { f.fieldName += "_0"; } newConfigInfo.fieldInfoDic.Add(f.fieldName, f); } GUILayout.EndHorizontal(); DrawFieldData(newConfigInfo); if (newConfigInfo.fieldInfoDic.Count > 0 && GUILayout.Button("创建")) { GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) => { Debug.Log("OnResourcesAssetsChange"); AssetsSortManagement.SetLayer(newFileName, configLayerName); AssetsSortManagement.Save(); newFileName = ""; newConfigInfo = null; }, true); string content = TableConfigTool.ConfigInfo2TableText(newConfigInfo, null); string path = CreateConfigClassEditor.SaveConfigFilePath + "/" + newFileName + ".txt"; FileUtils.CreateTextFile(path, content); CreateConfigClassEditor.CreateConfigClassFile(content, newFileName); AssetDatabase.Refresh(); } }
private void Start() { GlobalEvent.AddEvent(CameraMovement.CameraEvn.ToFont, ToFontFun); }
void ShowAllMapInfoGUI() { List <MapInfomation> mapInfos = new List <MapInfomation>(MapManager.MapInfosDic.Values); pos = GUILayout.BeginScrollView(pos, true, true); foreach (MapInfomation info in mapInfos) { bool isOpen = (currentLoadMap == info); if (isOpen) { GUI.color = Color.red; } GUILayout.BeginHorizontal(); GUILayout.BeginVertical("box"); GUILayout.Label("ID: " + info.id); //GUILayout.Label("Scene: " + info.sceneName); GUILayout.Label("MapFile: " + info.mapFileName); GUILayout.Space(4); GUILayout.Box("Light Map :"); info.isCreateLightMap = (bool)EditorDrawGUIUtil.DrawBaseValue("是否生成光照贴图", info.isCreateLightMap); if (info.isCreateLightMap) { info.lightMapSize = EditorGUILayout.IntPopup("光照贴图单张最大尺寸:", info.lightMapSize, lightMapSizeNames, lightMapSizeValue); LightmapEditorSettings.maxAtlasHeight = info.lightMapSize; LightmapEditorSettings.maxAtlasWidth = info.lightMapSize; GUILayout.Label("光照贴图文件: " + info.mapLightMap); } GUILayout.Space(4); GUILayout.Label("Collider File :" + info.mapColliderInfoFileName); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); if (GUILayout.Button(isOpen?"卸载地图": "加载地图", GUILayout.Width(120))) { if (!isOpen) { if (currentLoadMap != null) { if (EditorUtility.DisplayDialog("警告", "是否切换地图,请记得先保存!", "OK", "Cancel")) { MapManager.DestoryMapGameObjectInScene(currentLoadMap.id); currentLoadMap = null; } else { return; } } currentLoadMap = info; MapManager.CreateMapGameObjectInScene(info.id); GetCurrentEditMapRoot(); } else { if (EditorUtility.DisplayDialog("警告", "是否卸载地图,请记得先保存!", "OK", "Cancel")) { MapManager.DestoryMapGameObjectInScene(info.id); currentLoadMap = null; } } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Space(5); if (currentLoadMap == null && GUILayout.Button("删除")) { if (EditorUtility.DisplayDialog("警告", "是否删除地图:" + info.mapFileName, "OK", "Cancel")) { MapManager.MapInfosDic.Remove(info.id); GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, (t) => { Initialize(); }, true); SaveMapInfoData(); FileUtils.DeleteFile(MapUseConstValues.MapDataDirectory + info.mapFileName + "/" + info.mapFileName + ".txt"); AssetDatabase.Refresh(); return; } } GUI.color = oldColor; } GUILayout.EndScrollView(); }
private void HandleBookCaseDown(params object[] args) { GlobalEvent.AddEvent("WeightDropDown", HandleDropDownLogic); }
static void RunEditor() { GlobalEvent.AddEvent(EditorGlobalEventEnum.OnResourcesAssetsChange, OnResourcesChange); UnityLayerTagUtils.AddLayer(MapObjectLayer); }
public void Init() { GlobalEvent.AddEvent(LanguageEventEnum.LanguageChange, ReceviceLanguageChange); ResetLanguage(); }