示例#1
0
        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);
        }
示例#2
0
        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);
                        }
                    }
                }
            }
        }
示例#3
0
 public virtual void OnSCDestroy()
 {
     lock (subModuleList) {
         foreach (var Module in subModuleList)
         {
             Module.ModuleDestroy();
         }
     }
     subModuleList.Clear();
     DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCDestroy", this);
 }
示例#4
0
        public virtual void OnSCDisable()
        {
            lock (subModuleList) {
                foreach (var Module in subModuleList)
                {
                    Module.ModuleStop();
                }
            }

            DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCDisable", this);
        }
示例#5
0
 public void RemoveAllModule()
 {
     lock (subModuleList) {
         foreach (var item in subModuleList)
         {
             item.ModuleDestroy();
         }
     }
     DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "Remove All Module '" + GetType(), this);
     subModuleList.Clear();
 }
示例#6
0
        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;
        }
示例#7
0
        /// <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      = "";
        }
示例#8
0
 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));
 }
示例#9
0
        /// <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);
            }
        }
示例#10
0
        /// <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));
        }
示例#11
0
        /// <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();
        }
示例#12
0
        /// <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();
        }
示例#13
0
        /// <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;
        }
示例#14
0
        /// <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);
        }
示例#15
0
        /// <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();
        }
示例#16
0
        /// <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);
            }
        }
示例#17
0
 public void OnSCEnable()
 {
     DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCEnable", this);
 }
示例#18
0
 public virtual void OnSCAwake()
 {
     DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCAwake", this);
 }
示例#19
0
 public virtual void OnSCDestroy()
 {
     DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCDestroy", this);
 }
示例#20
0
 public virtual void OnSCStart()
 {
     DebugMy.Log("[HashCode: " + GetHashCode() + "] " + "OnSCStart", this);
 }