示例#1
0
    private IKeyObject createKeyInstance(BeatKey beatKey)
    {
        GameObject gameObject = Instantiate(regularKeyPrefab);
        IKeyObject keyObject  = gameObject.GetComponent <IKeyObject>();

        keyObject.initial(beatKey);

        return(keyObject);
    }
        public void BuildKeyDict()
        {
            this.keyDict = new Dictionary <string, ICachedEntity>(0x400);
            List <Type> cacheTableList = this.GetCacheTableList();

            foreach (Type type in cacheTableList)
            {
                if (type != typeof(King.Framework.EntityLibrary.SysPageControl))
                {
                    IList list = this.GetList(type);
                    if (list != null)
                    {
                        foreach (object obj2 in list)
                        {
                            if (!(obj2 is ICachedEntity))
                            {
                                throw new ApplicationException(string.Format("类型{0}未实现ICachedEntity", obj2.GetType()));
                            }
                            IKeyObject obj3 = obj2 as IKeyObject;
                            if (obj3 != null)
                            {
                                string key = "";
                                try
                                {
                                    key = obj3.GetKey();
                                    if (this.keyDict.ContainsKey(key))
                                    {
                                        King.Framework.EntityLibrary.SysCondition condition = obj3 as King.Framework.EntityLibrary.SysCondition;
                                        if (condition != null)
                                        {
                                            King.Framework.EntityLibrary.SysCondition condition2 = this.keyDict[key] as King.Framework.EntityLibrary.SysCondition;
                                            if (condition2.ParentCondition == condition)
                                            {
                                                this.keyDict[key] = condition;
                                            }
                                        }
                                        King.Framework.EntityLibrary.SysViewCondition condition3 = obj3 as King.Framework.EntityLibrary.SysViewCondition;
                                        if (condition3 != null)
                                        {
                                            King.Framework.EntityLibrary.SysViewCondition condition4 = this.keyDict[key] as King.Framework.EntityLibrary.SysViewCondition;
                                            if (condition4.ParentCondition == condition3)
                                            {
                                                this.keyDict[key] = condition3;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        this.keyDict.Add(key, obj3 as ICachedEntity);
                                    }
                                }
                                catch (Exception exception)
                                {
                                    Trace.WriteLine(string.Format("{0}", obj2));
                                    Trace.WriteLine(key);
                                    Trace.WriteLine(exception.Message);
                                    Trace.WriteLine(exception.StackTrace);
                                    throw exception;
                                }
                            }
                        }
                    }
                }
            }
        }