public static SCKeyboardBase Open(SCKeyboardEnum sckeyboardEnum, string text, TouchScreenKeyboardType touchScreenKeyboardType, Transform parent, Vector3 position, Quaternion rotation, Vector3 scale) { if (keyboardCacheDic.ContainsKey(parent)) { Dictionary <SCKeyboardEnum, SCKeyboardBase> keyboardEnumDic = keyboardCacheDic[parent]; if (keyboardEnumDic != null && keyboardEnumDic.ContainsKey(sckeyboardEnum)) { SCKeyboardBase keyboardCache = keyboardEnumDic[sckeyboardEnum]; keyboardCache.ResetKeyboard(); keyboardCache.SetKeyboardTransform(parent, position, rotation, scale); return(keyboardCache); } } if (!keyboardTypeDic.ContainsKey(sckeyboardEnum)) { DebugMy.LogError("This SCKeyboardEnum do not exist", sckeyboardEnum); return(null); } SCKeyboardBase keyboard = Activator.CreateInstance(keyboardTypeDic[sckeyboardEnum], parent, position, rotation, scale) as SCKeyboardBase; if (!keyboardCacheDic.ContainsKey(parent)) { keyboardCacheDic[parent] = new Dictionary <SCKeyboardEnum, SCKeyboardBase>(); } keyboardCacheDic[parent][sckeyboardEnum] = keyboard; return(keyboard); }
void Awake() { SDKConfiguration = Resources.Load <SDKConfiguration>("SDKConfiguration"); if (SDKConfiguration == null) { DebugMy.Log("SDKConfiguration Not Exist !", this, true); } configFile = new ConfigFile(fileConfigPath, true); if (Application.isEditor) { DebugMy.Log("Platfom isEditor: Remove SDKConfigs File", this, true); configFile.RemoveConfigFile(); } bool isExist = configFile.ParseConfig(); if (isExist == false) { DebugMy.Log("ConfigFile:" + fileConfigPath + " Not Exist !", this, true); } else { DebugMy.Log("ConfigFile:" + fileConfigPath + " Exist !", this, true); } if (SDKConfiguration) { configFile.SetString("SDK_Information", "Version", API_Module_SDKVersion.Version); if (isExist == false) { foreach (var section in SDKConfiguration.Configs) { foreach (var keyValue in section.KEY_VALUE) { configFile.SetString(section.section, keyValue.Name, keyValue.Value); DebugMy.Log("Write To ConfigsFile ==> [" + section.section + "]:" + keyValue.Name + "=" + keyValue.Value, this, true); } } configFile.SaveConfig(); } else { foreach (var dic in configFile.Configs.Keys) { foreach (var keyValue in configFile.Configs[dic]) { DebugMy.Log("Read From ConfigsFile ==> [" + dic + "]:" + keyValue.Key + "=" + keyValue.Value, this, true); } } } } }
public virtual void OnSCDestroy() { lock (subModuleList) { foreach (var Module in subModuleList) { Module.ModuleDestroy(); } } subModuleList.Clear(); DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCDestroy", this); }
public virtual void OnSCDisable() { lock (subModuleList) { foreach (var Module in subModuleList) { Module.ModuleStop(); } } DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCDisable", this); }
public void RemoveAllModule() { lock (subModuleList) { foreach (var item in subModuleList) { item.ModuleDestroy(); } } DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "Remove All Module '" + GetType(), this); subModuleList.Clear(); }
public void RemoveModule(ISCModule Module) { if (Module == null) { return; } DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "Module '" + Module.GetType() + "' [HashCode: " + Module.GetHashCode() + "] Remove From Module '" + GetType(), this); lock (subModuleList) { subModuleList.Remove(Module); } Module.ModuleDestroy(); Module.FatherModule = null; }
/// <summary> /// ModuleStop =================================== /// </summary> /// <summary> /// ModuleDestroy =================================== /// </summary> public void ModuleDestroy() { if (IsModuleInit == false) { DebugMy.Log("ModuleDestroy: Please Invoke ModuleInit First", this); return; } OnSCDestroy(); IsModuleInit = false; IsModuleStarted = false; FatherModule = null; ModuleName = ""; }
public virtual T GetSubModule <T>() where T : ISCModule { lock (subModuleList) { foreach (var Module in subModuleList) { if (typeof(T).ToString() == Module.ModuleName) { DebugMy.Log("[HashCode: " + GetHashCode() + "] Module" + typeof(T).ToString() + " Found ", this); return((T)Module); } } } DebugMy.Log("[HashCode: " + GetHashCode() + "] Module" + typeof(T).ToString() + " No Found ", this); return(default(T)); }
/// <summary> /// ModuleDestroy =================================== /// </summary> public void AddModule(ISCModule Module, bool isEffectGameObject = true, SCModulePriority priority = SCModulePriority.Middle) { if (Module == null) { return; } Module.FatherModule = this; Module.ModuleInit(isEffectGameObject, priority); DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "Module '" + Module.GetType() + "' [HashCode: " + Module.GetHashCode() + "] Add To Module '" + GetType(), this); lock (subModuleList) { subModuleList.Add(Module); } }
/// <summary> /// 返回直接父 /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public virtual T GetFatherModule <T>() where T : ISCModule { ISCModule father = FatherModule; while (father != null) { if (father.ModuleName == typeof(T).ToString()) { DebugMy.Log("[HashCode: " + GetHashCode() + "] FatherModule" + father.ModuleName + " Found ", this); return((T)father); } father = father.FatherModule; } DebugMy.Log("[HashCode: " + GetHashCode() + "] FatherModule" + typeof(T).ToString() + " Found ", this); return(default(T)); }
/// <summary> /// ModuleEnable =================================== /// </summary> /// <summary> /// Module 启动 =================================== /// </summary> public void ModuleStart() { if (!IsModuleInit) { DebugMy.Log("Please Invoke ModuleInit First", this); return; } if (IsModuleStarted) { DebugMy.Log("ModuleStart Had Invoke", this); return; } IsModuleStarted = true; OnSCStart(); }
/// <summary> /// Module 初始化 =================================== /// </summary> public void ModuleInit(bool isEffectGameObject = true, SCModulePriority priority = SCModulePriority.Middle) { if (IsModuleInit) { DebugMy.LogError("ModuleInit Had Invoke", this); return; } IsModuleInit = true; ModuleName = GetType().ToString(); IsMono = false; IsEffectGameObject = isEffectGameObject; Priority = priority; OnSCAwake(); }
/// <summary> /// ModuleEndOfFrame =================================== /// </summary> /// <summary> /// ModuleStop =================================== /// </summary> public void ModuleStop() { if (IsModuleInit == false) { DebugMy.Log("ModuleStop: Please Invoke ModuleInit First", this); return; } if (IsModuleStarted == false) { DebugMy.Log("ModuleStop: Please Invoke ModuleStart First", this); return; } OnSCDisable(); IsModuleStarted = false; }
/// <summary> /// 读取某行内容 /// </summary> /// <param name="line">起始1,1表示第一行</param> /// <returns></returns> public virtual string GetLineValue(int line) { string value = ""; StreamReader fs = null; if (File.Exists(patch)) { fs = new StreamReader(patch); for (int i = 1; i < line; i++) { fs.ReadLine(); } value = fs.ReadLine(); DebugMy.Log("config:" + patch + " line:" + line + " " + value, this); fs.Close(); } return(value); }
/// <summary> /// ModuleEnable =================================== /// </summary> /// <summary> /// Module 启动 =================================== /// </summary> public void ModuleStart() { if (!IsModuleInit) { DebugMy.Log("Please Invoke ModuleInit First", this); return; } if (IsModuleStarted) { DebugMy.Log("ModuleStart Had Invoke", this); return; } IsModuleStarted = true; if (IsEffectGameObject) { gameObject.SetActive(true); } OnSCStart(); }
/// <summary> /// ModuleEndOfFrame =================================== /// </summary> /// <summary> /// ModuleStop =================================== /// </summary> public void ModuleStop() { if (IsModuleInit == false) { DebugMy.Log("ModuleStop: Please Invoke ModuleInit First", this); return; } if (IsModuleStarted == false) { DebugMy.Log("ModuleStop: Please Invoke ModuleStart First", this); return; } OnSCDisable(); IsModuleStarted = false; if (IsEffectGameObject) { gameObject.SetActive(false); } }
public void OnSCEnable() { DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCEnable", this); }
public virtual void OnSCAwake() { DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCAwake", this); }
public virtual void OnSCDestroy() { DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCDestroy", this); }
public virtual void OnSCStart() { DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCStart", this); }