Ejemplo n.º 1
0
        protected override bool OnPrepare(UnityEngine.Object mainAsset)
        {
            // 开始异步加载场景
            string[] splits    = ResName.Split('/');
            string   sceneName = splits[splits.Length - 1];

            AppEngine.Instance.StartCoroutine(StartLoading(sceneName));
            return(true);
        }
Ejemplo n.º 2
0
        protected override bool OnPrepare(UnityEngine.Object asset, bool result)
        {
            if (base.OnPrepare(asset, result) == false)
            {
                return(false);
            }

            // 开始异步加载场景
            string[] splits    = ResName.Split('/');
            string   sceneName = splits[splits.Length - 1];

            Engine.Instance.StartCoroutine(StartLoading(sceneName));
            return(true);
        }
Ejemplo n.º 3
0
 public FieldSystem(DataRow row, Scan scan) : base(row, scan)
 {
     if (xlsName == Scan.ROW_ID)
     {
         isField = true;
         isRowId = true;
         Type    = Type.GetType("System.Int32");
     }
     else if ((ResName.Length >= Scan.SHEMA.Length) && (ResName.Substring(0, Scan.SHEMA.Length) == Scan.SHEMA))
     {
         isShema  = true;
         funcName = FieldFunc.getFuncName(xlsName);
     }
 }
        private void AddNewName(IList list, Type resNameType, int insertPoint, object name, ushort language, byte[] data)
        {
            ResName newResName = (ResName)Activator.CreateInstance(resNameType, name);

            newResName.LanguageId        = language;
            newResName.NumberOfLanguages = 1;
            newResName.DataEntry         = data;

            if (insertPoint == -1)
            {
                list.Add(newResName);
            }
            else
            {
                list.Insert(insertPoint, newResName);
            }
        }
Ejemplo n.º 5
0
        public static int ProcessTerminate(string ProcessName)
        {
            // Обнуляем PID...
            int ProcID = 0;

            // Фильтруем список процессов по заданной маске в параметрах и вставляем в массив...
            Process[] LocalByName = Process.GetProcessesByName(ProcessName);

            // Запускаем цикл по поиску и завершению процессов...
            foreach (Process ResName in LocalByName)
            {
                ProcID = ResName.Id; // Сохраняем PID процесса...
                ResName.Kill();      // Завершаем процесс...
            }

            // Возвращаем PID как результат функции...
            return(ProcID);
        }
Ejemplo n.º 6
0
        protected void OnLoadRes()
        {
            UIRootCanvas.worldCamera = FrameMgr.Instance.UICamera;

            GameObjectUtil.SetLayer(FrameRoot, LayerDefine.UIHideLayer);

            FrameRoot.name = ResName.Replace(".prefab", "");

            FrameRoot.SetActive(true);

            m_frameRenderer = new FrameVisibilityComponent(this);

            uiTweens = FrameRoot.GetComponentsInChildren <UITweenerBase>(false);

            OnFrameLoaded?.Invoke(this);

            //干掉没有用的Graphic
            m_frameRenderer.OptimizeFrameGraphic();
        }
Ejemplo n.º 7
0
        private void AddResource(object type, object name, ushort language, byte[] data)
        {
            ResType resType;

            if (type is ushort)
            {
                if (!_resTypeHeadID.TryGetValue((ushort)type, out resType))
                {
                    resType = new ResType();
                    _resTypeHeadID[(ushort)type] = resType;
                }
            }
            else
            {
                if (!_resTypeHeadName.TryGetValue((string)type, out resType))
                {
                    resType = new ResType();
                    _resTypeHeadName[(string)type] = resType;
                }
            }

            ResName resName;

            if (name is ushort)
            {
                if (!resType.NameHeadID.TryGetValue((ushort)name, out resName))
                {
                    resName = new ResName();
                    resType.NameHeadID[(ushort)name] = resName;
                }
            }
            else
            {
                if (!resType.NameHeadName.TryGetValue((string)name, out resName))
                {
                    resName = new ResName();
                    resType.NameHeadName[(string)name] = resName;
                }
            }

            resName.Languages[language] = new ResLanguage(data);
        }
Ejemplo n.º 8
0
        private byte[] FindResourceInternal(object name, object type, ushort language)
        {
            ResType resType = null;

            if (type is ushort)
            {
                _resTypeHeadID.TryGetValue((ushort)type, out resType);
            }
            if (type is string)
            {
                _resTypeHeadName.TryGetValue((string)type, out resType);
            }

            if (resType == null)
            {
                return(null);
            }

            ResName resName = null;

            if (name is ushort)
            {
                resType.NameHeadID.TryGetValue((ushort)name, out resName);
            }
            if (name is string)
            {
                resType.NameHeadName.TryGetValue((string)name, out resName);
            }

            if (resName == null)
            {
                return(null);
            }

            if (!resName.Languages.TryGetValue(language, out ResLanguage resLanguage))
            {
                return(null);
            }

            return((byte[])resLanguage.DataEntry.Clone());
        }
Ejemplo n.º 9
0
        public static int ProcessTerminate(string ProcessName)
        {
            // Setting default PID to 0...
            int ProcID = 0;

            // Filtering processes by name and creating array...
            Process[] LocalByName = Process.GetProcessesByName(ProcessName);

            // Using loop to terminate all processes from this array...
            foreach (Process ResName in LocalByName)
            {
                // Saving PID...
                ProcID = ResName.Id;

                // Terminating process...
                ResName.Kill();
            }

            // Returning PID of terminated process or default value...
            return(ProcID);
        }
        private void AddResource(object type, object name, ushort language, byte[] data)
        {
            ResType resType = null;
            // Allocate new object in case it is needed.
            ResType newResType;
            int     newIndex;

            IList typeList;
            bool  updateExisting;

            if (type is ushort)
            {
                ResType_Ordinal newOrdinalType = new ResType_Ordinal((ushort)type);
                newResType = newOrdinalType;
                typeList   = _resTypeHeadID;

                newIndex = GetIndexOfFirstItemMatchingInListOrInsertionPoint(typeList, (ushort left, ushort right) => (int)left - (int)right, (ushort)type, out updateExisting);
            }
            else
            {
                ResType_Name newStringType = new ResType_Name((string)type);
                newResType = newStringType;
                typeList   = _resTypeHeadName;

                newIndex = GetIndexOfFirstItemMatchingInListOrInsertionPoint(typeList, string.CompareOrdinal, (string)type, out updateExisting);
            }

            if (updateExisting)
            {
                resType = (ResType)typeList[newIndex];
            }
            else
            {
                // This is a new type
                if (newIndex == -1)
                {
                    typeList.Add(newResType);
                }
                else
                {
                    typeList.Insert(newIndex, newResType);
                }

                resType = newResType;
            }

            Type  resNameType;
            IList nameList;
            int   nameIndex;

            if (name is ushort)
            {
                nameList    = resType.NameHeadID;
                resNameType = typeof(ResName_Ordinal);
                nameIndex   = GetIndexOfFirstItemMatchingInListOrInsertionPoint(nameList, (ushort left, ushort right) => (int)left - (int)right, (ushort)name, out updateExisting);
            }
            else
            {
                nameList    = resType.NameHeadName;
                resNameType = typeof(ResName_Name);
                nameIndex   = GetIndexOfFirstItemMatchingInListOrInsertionPoint(nameList, string.CompareOrdinal, (string)name, out updateExisting);
            }

            if (updateExisting)
            {
                // We have at least 1 language with the same type/name. Insert/delete from language list
                ResName resName = (ResName)nameList[nameIndex];
                int     newNumberOfLanguages = (int)resName.NumberOfLanguages + (data != null ? 1 : -1);

                int newIndexForNewOrUpdatedNameWithMatchingLanguage = GetIndexOfFirstItemMatchingInListOrInsertionPoint(nameList, nameIndex,
                                                                                                                        resName.NumberOfLanguages, (object o) => ((ResName)o).LanguageId, (ushort left, ushort right) => (int)left - (int)right, language, out bool exactLanguageExists);

                if (exactLanguageExists)
                {
                    if (data == null)
                    {
                        // delete item
                        nameList.RemoveAt(newIndexForNewOrUpdatedNameWithMatchingLanguage);

                        if (newNumberOfLanguages > 0)
                        {
                            // if another name is still present, update the number of languages counter
                            resName = (ResName)nameList[nameIndex];
                            resName.NumberOfLanguages = (ushort)newNumberOfLanguages;
                        }

                        if ((resType.NameHeadID.Count == 0) && (resType.NameHeadName.Count == 0))
                        {
                            /* type list completely empty? */
                            typeList.Remove(resType);
                        }
                    }
                    else
                    {
                        // Resource file has two copies of same resource... ignore second copy
                        return;
                    }
                }
                else
                {
                    // Insert a new name at the new spot
                    AddNewName(nameList, resNameType, newIndexForNewOrUpdatedNameWithMatchingLanguage, name, language, data);
                    // Update the NumberOfLanguages for the language list
                    resName = (ResName)nameList[nameIndex];
                    resName.NumberOfLanguages = (ushort)newNumberOfLanguages;
                }
            }
            else
            {
                // This is a new name in a new language list
                if (data == null)
                {
                    // Can't delete new name
                    throw new ArgumentException();
                }

                AddNewName(nameList, resNameType, nameIndex, name, language, data);
            }
        }