コード例 #1
0
ファイル: SList.cs プロジェクト: shineTeam7/home3
        /** 截取list */
        public SList <V> subList(int from, int end)
        {
            if (from < 0)
            {
                from = 0;
            }

            if (end >= size())
            {
                end = size();
            }

            int len = end - from;

            if (len == 0)
            {
                return(new SList <V>());
            }

            if (len < 0)
            {
                Ctrl.throwError("subList,数据非法", from, end);
                return(new SList <V>());
            }

            SList <V> re = new SList <V>(len);

            Array.Copy(_values, from, re._values, 0, len);
            re.justSetSize(len);
            return(re);
        }
コード例 #2
0
        /** 输出数据列表 */
        public static void printDataList <T>(SList <T> list) where T : BaseData
        {
            StringBuilder sb = StringBuilderPool.create();

            T data;

            for (int i = 0, len = list.size(); i < len; i++)
            {
                data = list.get(i);

                sb.Append(i);
                sb.Append(":");

                if (data == null)
                {
                    sb.Append("null");
                }
                else
                {
                    sb.Append(data.toDataString());
                }

                sb.Append("\n");
            }

            Ctrl.print(StringBuilderPool.releaseStr(sb));
        }
コード例 #3
0
        public SList <V> toList()
        {
            SList <V> re = new SList <V>(_size);

            if (_size == 0)
            {
                return(re);
            }

            V[] rValues = re.getValues();

            V[] values = _values;

            //正常的
            if (_end > _start)
            {
                Array.Copy(values, _start, rValues, 0, _end - _start);
            }
            else
            {
                int d = values.Length - _start;

                Array.Copy(values, _start, rValues, 0, d);
                Array.Copy(values, 0, rValues, d, _end);
            }

            re.justSetSize(_size);

            return(re);
        }
コード例 #4
0
ファイル: SList.cs プロジェクト: shineTeam7/home3
 public ForEachIterator(SList <V> list)
 {
     _tValues = list._values;
     _tSize   = list._size;
     _index   = 0;
     _v       = default(V);
 }
コード例 #5
0
ファイル: FileUtils.cs プロジェクト: shineTeam7/home3
        private static SList <string> toGetDeepFileListForIgnore(bool isDeep, string path, params string[] exIgnore)
        {
            string[] files = Directory.GetFiles(path, "*", isDeep ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);

            SList <string> re = new SList <string>();

            string s;

            for (int i = files.Length - 1; i >= 0; --i)
            {
                s = files[i];

                if (s.EndsWith(".DS_Store"))
                {
                    continue;
                }

                if (exIgnore.Length > 0)
                {
                    if (Array.IndexOf(exIgnore, getFileExName(s)) != -1)
                    {
                        continue;
                    }
                }

                re.add(fixPath(s));
            }

            return(re);
        }
コード例 #6
0
ファイル: SSet.cs プロジェクト: shineTeam7/home3
        /** 获取排序好的List */
        public SList <K> getSortedList()
        {
            SList <K> list = new SList <K>(_size);

            if (_size == 0)
            {
                return(list);
            }

            K[] values = list.getValues();
            int j      = 0;

            K[] keys = _set;
            K   k;

            for (int i = keys.Length - 1; i >= 0; --i)
            {
                if ((k = keys[i]) != null)
                {
                    values[j++] = k;
                }
            }

            list.justSetSize(size());

            list.sort();

            return(list);
        }
コード例 #7
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.name     = "";
     this.type     = 0;
     this.style    = "";
     this.children = null;
     this.intArgs  = null;
     this.strArgs  = null;
 }
コード例 #8
0
        /** []数组转对象数组 */
        public static SList <T> arrToSList <T>(T[] arr)
        {
            SList <T> list = new SList <T>(arr.Length);

            for (int i = 0; i < arr.Length; i++)
            {
                list.add(arr[i]);
            }
            return(list);
        }
コード例 #9
0
        /** intList转slist */
        public static SList <int> intListToSList(IntList arr)
        {
            SList <int> list = new SList <int>(arr.length());

            for (int i = 0; i < arr.length(); i++)
            {
                list.add(arr[i]);
            }
            return(list);
        }
コード例 #10
0
        /** longMap转SList */
        public static SList <T> longObjectMapToSList <T>(LongObjectMap <T> map)
        {
            SList <T> sList = new SList <T>(map.length());

            map.forEach((k, v) =>
            {
                sList.add(v);
            });

            return(sList);
        }
コード例 #11
0
        /** SList拷贝SList */
        public static SList <T> sListCopyToSLst <T>(SList <T> sList)
        {
            SList <T> list = new SList <T>(sList.length());

            sList.forEach((v) =>
            {
                list.add(v);
            });

            return(list);
        }
コード例 #12
0
ファイル: SList.cs プロジェクト: shineTeam7/home3
        public SList <V> clone()
        {
            if (_size == 0)
            {
                return(new SList <V>());
            }

            SList <V> re = new SList <V>(_size);

            Array.Copy(_values, 0, re._values, 0, _size);
            re._size = _size;
            return(re);
        }
コード例 #13
0
        public static void init()
        {
            /** 初始化将枚举存储为数组 */
//			Array keyList=Enum.GetValues(typeof(KeyCode));
//			_keys=new KeyCode[keyList.Length];
//			for(int i=keyList.Length - 1;i>=0;--i)
//			{
//				_keys[i]=(KeyCode)keyList.GetValue(i);
//			}

            SList <KeyCode> list = new SList <KeyCode>();

            //a-z
            for (int i = (int)KeyCode.A, len = (int)KeyCode.Z; i <= len; ++i)
            {
                list.add((KeyCode)i);
            }

            //0-9
            for (int i = (int)KeyCode.Alpha0, len = (int)KeyCode.Alpha9; i <= len; ++i)
            {
                list.add((KeyCode)i);
            }

            //0-9
            for (int i = (int)KeyCode.Keypad0, len = (int)KeyCode.Keypad9; i <= len; ++i)
            {
                list.add((KeyCode)i);
            }

            //esc
            list.add(KeyCode.Escape);
            list.add(KeyCode.BackQuote);
            //enter
            list.add(KeyCode.Return);
            list.add(KeyCode.KeypadEnter);

            list.add(KeyCode.LeftControl);
            list.add(KeyCode.LeftCommand);
            list.add(KeyCode.LeftShift);
            list.add(KeyCode.LeftAlt);

            list.add(KeyCode.RightControl);
            list.add(KeyCode.RightCommand);
            list.add(KeyCode.RightShift);
            list.add(KeyCode.RightAlt);

            _keys = list.toArray();

            TimeDriver.instance.setUpdate(onUpdate);
        }
コード例 #14
0
ファイル: SSet.cs プロジェクト: shineTeam7/home3
        /** 添加一组 */
        public void addAll(SList <K> list)
        {
            if (list.isEmpty())
            {
                return;
            }

            K[] values = list.getValues();

            for (int i = 0, len = list.size(); i < len; ++i)
            {
                add(values[i]);
            }
        }
コード例 #15
0
ファイル: GridContainer.cs プロジェクト: shineTeam7/home3
        /** 初始化容器布局 */
        protected virtual void initContainer()
        {
            if (ShineSetting.isEditor)
            {
                _dataList = new SList <object>(100);
                _dataList.justSetSize(100);
            }
            else
            {
                _dataList = new SList <object>();
            }

            resize();
        }
コード例 #16
0
ファイル: SList.cs プロジェクト: shineTeam7/home3
        /** 添加一组 */
        public void addAll(SList <V> list)
        {
            if (list.isEmpty())
            {
                return;
            }

            int d = _size + list._size;

            ensureCapacity(d);

            Array.Copy(list._values, 0, this._values, this._size, list._size);

            _size = d;
        }
コード例 #17
0
        /// <summary>
        /// 复制(潜拷贝)
        /// </summary>
        protected override void toShadowCopy(BaseData data)
        {
            if (!(data is UIObjectData))
            {
                return;
            }

            UIObjectData mData = (UIObjectData)data;

            this.name     = mData.name;
            this.type     = mData.type;
            this.style    = mData.style;
            this.children = mData.children;
            this.intArgs  = mData.intArgs;
            this.strArgs  = mData.strArgs;
        }
コード例 #18
0
ファイル: GridContainer.cs プロジェクト: shineTeam7/home3
        /// <summary>
        /// 设置格子数据
        /// </summary>
        /// <param name="list">数据列表</param>
        public void setDataList <T>(SList <T> list)
        {
            SList <object> temp;

            (temp = _dataList).clear();

            T[] values = list.getValues();
            for (int i = 0, len = list.size(); i < len; i++)
            {
                temp.add(values[i]);
            }

            clearDataCache();

            doSetDataList();
        }
コード例 #19
0
        //传递组数据
        public void swap(LoadPackObj target)
        {
            SList <LoadOneObj> tObjs = objs;

            objs        = target.objs;
            target.objs = tObjs;

            SSet <LoadPackObj> tDepends = depends;

            depends        = target.depends;
            target.depends = tDepends;

            SSet <LoadPackObj> tBeDepends = beDepends;

            beDepends        = target.beDepends;
            target.beDepends = tBeDepends;
        }
コード例 #20
0
        /** 获取名为name的子组 */
        public SList <XML> getChildrenByName(string name)
        {
            SList <XML> list = new SList <XML>();

            XML[] values = _children.getValues();
            XML   v;

            for (int i = 0, len = _children.size(); i < len; ++i)
            {
                if ((v = values[i])._name.Equals(name))
                {
                    list.add(v);
                }
            }

            return(list);
        }
コード例 #21
0
ファイル: ACStringFilter.cs プロジェクト: shineTeam7/home3
        public bool init(SList <string> keyWords)
        {
            clear();

            if (keyWords != null && !keyWords.isEmpty())
            {
                string[] values = keyWords.getValues();
                string   v;

                for (int i1 = 0, len = keyWords.size(); i1 < len; ++i1)
                {
                    v = values[i1];

                    if (v == null || (v = StringUtils.trim(v)).Length == 0)
                    {
                        continue;
                    }

                    DFANode currentDFANode = dfaEntrance;
                    for (int i = 0; i < v.Length; i++)
                    {
                        char _c = v[i];
                        // 逐点加入DFA
                        char    _lc   = toLowerCaseWithoutConfict(_c);
                        DFANode _next = currentDFANode.dfaTransition.get(_lc);
                        if (_next == null)
                        {
                            _next = new DFANode();
                            currentDFANode.dfaTransition.put(_lc, _next);
                        }
                        currentDFANode = _next;
                    }
                    if (currentDFANode != dfaEntrance)
                    {
                        currentDFANode.isTerminal = true;
                    }
                }
            }

            buildFailNode();
            return(true);
        }
コード例 #22
0
ファイル: FileUtils.cs プロジェクト: shineTeam7/home3
        /** 递归获取文件列表(多格式) */
        private static SList <string> toGetFileMutipleList(bool isDeep, string path, params string[] exNames)
        {
            SList <string> re = new SList <string>();

            foreach (string exName in exNames)
            {
                string[] files = Directory.GetFiles(path, "*." + exName, isDeep ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);

                for (int i = files.Length - 1; i >= 0; --i)
                {
                    if (files[i].EndsWith(".DS_Store"))
                    {
                        continue;
                    }

                    re.add(fixPath(files[i]));
                }
            }

            return(re);
        }
コード例 #23
0
ファイル: CharObjectMap.cs プロジェクト: shineTeam7/home3
        /** 获取值组 */
        public SList <V> getValueList()
        {
            SList <V> list = new SList <V>(_size);

            if (_size == 0)
            {
                return(list);
            }

            V[] vals = _values;
            V   v;

            for (int i = vals.Length - 1; i >= 0; --i)
            {
                if ((v = vals[i]) != null)
                {
                    list.add(v);
                }
            }

            return(list);
        }
コード例 #24
0
        private static void doOneGenerate(XML xml, string controlClsPath, string adapterOutPath, int projectType)
        {
            clearGenerate();

            string[] fileList = FileUtils.getFileList(adapterOutPath, "cs");

            SMap <string, string> fileMap = new SMap <string, string>();

            foreach (string s in fileList)
            {
                string fN = FileUtils.getFileNameWithoutEx(s);

                if (fN.EndsWith("Adapter"))
                {
                    fileMap.put(fN.Substring(0, fN.Length - 7), s);
                }
            }

            _isShine = projectType == 0;

            int aLen = "Assets/".Length;

            //先处理包路径
            foreach (XML xl in xml.getChildrenByName("root"))
            {
                SList <string> ignoreList = new SList <string>();

                foreach (XML pXml in xl.getChildrenByName("ignorePath"))
                {
                    ignoreList.add(pXml.getProperty("path"));
                }

                StringIntMap hotfixPathDic = new StringIntMap();

                foreach (XML pXml in xl.getChildrenByName("hotfixPath"))
                {
                    hotfixPathDic.put(pXml.getProperty("path"), pXml.getProperty("needFactory").Equals("true") ? 1 : 0);
                }

                string rootPath = "Assets/" + xl.getProperty("path");

                string[] deepFileList = FileUtils.getDeepFileList(rootPath, "cs");

                foreach (string s in deepFileList)
                {
                    //编辑器类的跳过
                    if (s.Contains("/Editor/"))
                    {
                        continue;
                    }

                    string tailPath = s.Substring(rootPath.Length + 1);

                    bool failed = false;

                    //排除组
                    foreach (string ig in ignoreList)
                    {
                        if (tailPath.StartsWith(ig))
                        {
                            failed = true;
                            break;
                        }
                    }

                    if (failed)
                    {
                        continue;
                    }

                    string fQName = FileUtils.getFileFrontName(s.Substring(aLen));

                    String fName = FileUtils.getFileName(fQName);

                    _clsNameToPathDic.put(fName, fQName);

                    string[] keys   = hotfixPathDic.getKeys();
                    int[]    values = hotfixPathDic.getValues();
                    string   k;
                    int      v;

                    for (int i = keys.Length - 1; i >= 0; --i)
                    {
                        if ((k = keys[i]) != null)
                        {
                            v = values[i];

                            //需要
                            if (tailPath.StartsWith(k))
                            {
                                _adapterClsDic.add(fName);

                                if (v == 1)
                                {
                                    _factoryClsDic.add(fName);
                                }

                                break;
                            }
                        }
                    }
                }
            }


            string clsStr = FileUtils.readFileForUTF(controlClsPath);

            string projectMark    = getProjectMark(projectType);
            string factoryClsPath = getFactoryClsPath(projectType);

            ClsAnalysis.FactoryClassInfo factoryClass = null;
            string factoryClsName = null;

            if (!_isShine)
            {
                factoryClass   = ClsAnalysis.readFactory(factoryClsPath);
                factoryClsName = FileUtils.getFileFrontName(FileUtils.getFileName(factoryClsPath));

                //遍历父
                for (int i = projectType - 1; i >= Project_Common; i--)
                {
                    ClsAnalysis.FactoryClassInfo parentFactoryCls = ClsAnalysis.readFactory(getFactoryClsPath(i));

                    factoryClass.addParent(parentFactoryCls);
                }
            }

            StringBuilder sb = new StringBuilder();

            endClsLine(sb);

            if (!_isShine)
            {
                sb.Append("base.initOtherAdapters(appdomain);");
                endClsLine(sb);
            }


            TypeInfo factoryTypeInfo = null;

            if (!_isShine)
            {
                //工厂最后执行
                factoryTypeInfo = getTypeInfo(factoryClsName);

                _clsNameToPathDic.remove(factoryClsName);
            }

            //ex
            foreach (XML xl in xml.getChildrenByName("customClass"))
            {
                ILClassInfo cls = new ILClassInfo(xl.getProperty("name"));

                foreach (XML mXml in xl.getChildrenByName("method"))
                {
                    string visitTypeStr = mXml.getProperty("visitType");
                    int    visitType    = visitTypeStr.isEmpty() ? VisitType.Protected : VisitType.getTypeByName(visitTypeStr);

                    string needBaseCallStr = mXml.getProperty("needBaseCall");
                    bool   needBaseCall    = needBaseCallStr.isEmpty() ? true : StringUtils.strToBoolean(needBaseCallStr);

                    string   argsStr = mXml.getProperty("args");
                    string[] args    = argsStr.isEmpty() ? ObjectUtils.EmptyStringArr : argsStr.Split(',');

                    cls.addMethod(mXml.getProperty("name"), mXml.getProperty("returnType"), visitType, needBaseCall, args);
                }

                doOneClass(cls, adapterOutPath, _isShine, sb);
                fileMap.remove(cls.clsName);
            }

            foreach (string k in _clsNameToPathDic.getSortedMapKeys())
            {
                TypeInfo typeInfo = getTypeInfo(k);

                if (typeInfo == null)
                {
                    if (!_isShine)
                    {
                        Ctrl.throwError("不该找不到类型", k);
                    }
                }
                else
                {
                    if (typeInfo.hasHotfixMark || !typeInfo.isEmpty())
                    {
                        //需要工厂,并且不是虚类
                        if (!_isShine && !typeInfo.iCls.isAbstract && (typeInfo.needFactory || _factoryClsDic.contains(k)))
                        {
                            ClsAnalysis.FMethod method = factoryClass.addMethod(k, projectMark);
                            //补方法
                            factoryTypeInfo.iCls.addMethod("create" + method.name, method.returnType, VisitType.Public, true);
                        }

                        //需要适配器
                        if (typeInfo.hasHotfixMark || _adapterClsDic.contains(k))
                        {
                            doOneClass(typeInfo.iCls, adapterOutPath, _isShine, sb);
                            fileMap.remove(typeInfo.clsName);
                        }
                    }
                }
            }

            if (!_isShine)
            {
                doOneClass(factoryTypeInfo.iCls, adapterOutPath, _isShine, sb);
                fileMap.remove(factoryTypeInfo.clsName);
            }

            //去掉最后一个tab
            sb.Remove(sb.Length - 1, 1);

            clsStr = replaceMethod(clsStr, "protected " + (_isShine ? "virtual" : "override") + " void initOtherAdapters(AppDomain appdomain)", sb.ToString());

            if (!_isShine)
            {
                factoryClass.writeToPath(factoryClsPath);
            }

            FileUtils.writeFileForUTF(controlClsPath, clsStr);

            if (!fileMap.isEmpty())
            {
                fileMap.forEach((k, v) =>
                {
                    FileUtils.deleteFile(v);
                });
            }
        }
コード例 #25
0
        /// <summary>
        /// 复制(深拷贝)
        /// </summary>
        protected override void toCopy(BaseData data)
        {
            if (!(data is UIObjectData))
            {
                return;
            }

            UIObjectData mData = (UIObjectData)data;

            this.name = mData.name;

            this.type = mData.type;

            this.style = mData.style;

            if (mData.children != null)
            {
                if (this.children != null)
                {
                    this.children.clear();
                    this.children.ensureCapacity(mData.children.size());
                }
                else
                {
                    this.children = new SList <UIObjectData>();
                }

                SList <UIObjectData> childrenT = this.children;
                if (!mData.children.isEmpty())
                {
                    UIObjectData[] childrenVValues = mData.children.getValues();
                    for (int childrenVI = 0, childrenVLen = mData.children.length(); childrenVI < childrenVLen; ++childrenVI)
                    {
                        UIObjectData childrenV = childrenVValues[childrenVI];
                        UIObjectData childrenU;
                        if (childrenV != null)
                        {
                            childrenU = (UIObjectData)BytesControl.createData(UIObjectData.dataID);
                            childrenU.copy(childrenV);
                        }
                        else
                        {
                            childrenU = null;
                        }

                        childrenT.add(childrenU);
                    }
                }
            }
            else
            {
                this.children = null;
            }

            if (mData.intArgs != null)
            {
                int[] intArgsR   = mData.intArgs;
                int   intArgsLen = intArgsR.Length;
                if (this.intArgs == null || this.intArgs.Length != intArgsLen)
                {
                    this.intArgs = new int[intArgsLen];
                }
                BytesControl.arrayCopy(mData.intArgs, this.intArgs, intArgsLen);
            }
            else
            {
                this.intArgs = null;
            }

            if (mData.strArgs != null)
            {
                string[] strArgsR   = mData.strArgs;
                int      strArgsLen = strArgsR.Length;
                if (this.strArgs == null || this.strArgs.Length != strArgsLen)
                {
                    this.strArgs = new string[strArgsLen];
                }
                string[] strArgsT = this.strArgs;
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsV = strArgsR[strArgsI];
                    string strArgsU;
                    strArgsU = strArgsV;

                    strArgsT[strArgsI] = strArgsU;
                }
            }
            else
            {
                this.strArgs = null;
            }
        }
コード例 #26
0
ファイル: ILRuntimeControl.cs プロジェクト: shineTeam7/home3
        public void initSAdapters(SList <ILClassInfo> list)
        {
            ILClassInfo cls;

            list.add(cls = new ILClassInfo("MonoBehaviour"));
            cls.addMethod("Start", null, VisitType.Private, false);
            cls.addMethod("Update", null, VisitType.Private, false);
            cls.addMethod("FixedUpdate", null, VisitType.Private, false);
            cls.addMethod("OnGUI", null, VisitType.Private, false);
            cls.addMethod("OnDestroy", null, VisitType.Private, false);

            list.add(cls = new ILClassInfo("BaseData"));
            cls.addMethod("toReadBytesFull", VisitType.Protected, "BytesReadStream", "stream");
            cls.addMethod("toWriteBytesFull", VisitType.Protected, "BytesWriteStream", "stream");
            cls.addMethod("toReadBytesSimple", VisitType.Protected, "BytesReadStream", "stream");
            cls.addMethod("toWriteBytesSimple", VisitType.Protected, "BytesWriteStream", "stream");
            cls.addMethod("toCopy", VisitType.Protected, "BaseData", "data");
            cls.addMethod("toShadowCopy", VisitType.Protected, "BaseData", "data");
            cls.addMethod("toDataEquals", "bool", VisitType.Protected, true, "BaseData", "data");
            cls.addMethod("getDataClassName", "string", VisitType.Public, true);
            cls.addMethod("toWriteDataString", VisitType.Protected, "DataWriter", "writer");
            cls.addMethod("initDefault", VisitType.Public);
            cls.addMethod("beforeWrite", VisitType.Protected);
            cls.addMethod("afterRead", VisitType.Protected);

            list.add(cls = new ILClassInfo("BaseRequest"));
            cls.addMethod("copyData", VisitType.Protected);
            cls.addMethod("toWriteBytesSimple", VisitType.Protected, "BytesWriteStream", "stream");
            cls.addMethod("doWriteToStream", VisitType.Protected, "BytesWriteStream", "stream");
            cls.addMethod("doWriteBytesSimple", VisitType.Protected, "BytesWriteStream", "stream");


            list.add(cls = new ILClassInfo("BaseResponse"));
            cls.addMethod("toReadBytesSimple", VisitType.Protected, "BytesReadStream", "stream");
            cls.addMethod("readFromStream", "BaseResponse", VisitType.Public, true, "BytesReadStream", "stream");
            cls.addMethod("preExecute", VisitType.Protected);
            cls.addMethod("execute", null, VisitType.Protected, false);

            list.add(cls = new ILClassInfo("BytesHttpRequest"));
            cls.addMethod("copyData", VisitType.Protected);
            cls.addMethod("toWriteBytesSimple", VisitType.Protected, "BytesWriteStream", "stream");
            cls.addMethod("toRead", null, VisitType.Protected, false);
            cls.addMethod("onComplete", null, VisitType.Protected, false);

            list.add(new ILClassInfo("DataMaker"));

            list.add(cls = new ILClassInfo("DebugControl"));
            cls.addMethod("init", VisitType.Public);
            cls.addMethod("dispose", VisitType.Public);
            cls.addMethod("onPrint", VisitType.Public, "string", "str");

            list.add(cls = new ILClassInfo("UIContainer"));
            cls.addMethod("init", VisitType.Public, "GameObject", "obj");

            list.add(cls = new ILClassInfo("UIElement"));
            cls.addMethod("init", VisitType.Public, "GameObject", "obj");

            list.add(cls = new ILClassInfo("UIModel"));
            cls.addMethod("init", VisitType.Public, "GameObject", "obj");

            list.add(cls = new ILClassInfo("PoolObject"));
            cls.addMethod("clear", null, VisitType.Public, false);
        }
コード例 #27
0
ファイル: ILRuntimeControl.cs プロジェクト: shineTeam7/home3
 public virtual void initGAdapters(SList <ILClassInfo> list)
 {
 }
コード例 #28
0
        /// <summary>
        /// 是否数据一致
        /// </summary>
        protected override bool toDataEquals(BaseData data)
        {
            UIObjectData mData = (UIObjectData)data;

            if (this.name != mData.name)
            {
                return(false);
            }

            if (this.type != mData.type)
            {
                return(false);
            }

            if (this.style != mData.style)
            {
                return(false);
            }

            if (mData.children != null)
            {
                if (this.children == null)
                {
                    return(false);
                }
                if (this.children.size() != mData.children.size())
                {
                    return(false);
                }
                SList <UIObjectData> childrenT = this.children;
                SList <UIObjectData> childrenR = mData.children;
                int childrenLen = childrenT.size();
                for (int childrenI = 0; childrenI < childrenLen; ++childrenI)
                {
                    UIObjectData childrenU = childrenT.get(childrenI);
                    UIObjectData childrenV = childrenR.get(childrenI);
                    if (childrenV != null)
                    {
                        if (childrenU == null)
                        {
                            return(false);
                        }
                        if (!childrenU.dataEquals(childrenV))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        if (childrenU != null)
                        {
                            return(false);
                        }
                    }
                }
            }
            else
            {
                if (this.children != null)
                {
                    return(false);
                }
            }

            if (mData.intArgs != null)
            {
                if (this.intArgs == null)
                {
                    return(false);
                }
                if (this.intArgs.Length != mData.intArgs.Length)
                {
                    return(false);
                }
                int[] intArgsT   = this.intArgs;
                int[] intArgsR   = mData.intArgs;
                int   intArgsLen = intArgsT.Length;
                for (int intArgsI = 0; intArgsI < intArgsLen; ++intArgsI)
                {
                    int intArgsU = intArgsT[intArgsI];
                    int intArgsV = intArgsR[intArgsI];
                    if (intArgsU != intArgsV)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (this.intArgs != null)
                {
                    return(false);
                }
            }

            if (mData.strArgs != null)
            {
                if (this.strArgs == null)
                {
                    return(false);
                }
                if (this.strArgs.Length != mData.strArgs.Length)
                {
                    return(false);
                }
                string[] strArgsT   = this.strArgs;
                string[] strArgsR   = mData.strArgs;
                int      strArgsLen = strArgsT.Length;
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsU = strArgsT[strArgsI];
                    string strArgsV = strArgsR[strArgsI];
                    if (strArgsU != strArgsV)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (this.strArgs != null)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #29
0
        /// <summary>
        /// 转文本输出
        /// </summary>
        protected override void toWriteDataString(DataWriter writer)
        {
            writer.writeTabs();
            writer.sb.Append("name");
            writer.sb.Append(':');
            writer.sb.Append(this.name);

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("type");
            writer.sb.Append(':');
            writer.sb.Append(this.type);

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("style");
            writer.sb.Append(':');
            writer.sb.Append(this.style);

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("children");
            writer.sb.Append(':');
            writer.sb.Append("List<UIObjectData>");
            if (this.children != null)
            {
                SList <UIObjectData> childrenT = this.children;
                int childrenLen = childrenT.size();
                writer.sb.Append('(');
                writer.sb.Append(childrenLen);
                writer.sb.Append(')');
                writer.writeEnter();
                writer.writeLeftBrace();
                for (int childrenI = 0; childrenI < childrenLen; ++childrenI)
                {
                    UIObjectData childrenV = childrenT.get(childrenI);
                    writer.writeTabs();
                    writer.sb.Append(childrenI);
                    writer.sb.Append(':');
                    if (childrenV != null)
                    {
                        childrenV.writeDataString(writer);
                    }
                    else
                    {
                        writer.sb.Append("UIObjectData=null");
                    }

                    writer.writeEnter();
                }
                writer.writeRightBrace();
            }
            else
            {
                writer.sb.Append("=null");
            }

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("intArgs");
            writer.sb.Append(':');
            writer.sb.Append("Array<int>");
            if (this.intArgs != null)
            {
                int[] intArgsT   = this.intArgs;
                int   intArgsLen = intArgsT.Length;
                writer.sb.Append('(');
                writer.sb.Append(intArgsLen);
                writer.sb.Append(')');
                writer.writeEnter();
                writer.writeLeftBrace();
                for (int intArgsI = 0; intArgsI < intArgsLen; ++intArgsI)
                {
                    int intArgsV = intArgsT[intArgsI];
                    writer.writeTabs();
                    writer.sb.Append(intArgsI);
                    writer.sb.Append(':');
                    writer.sb.Append(intArgsV);

                    writer.writeEnter();
                }
                writer.writeRightBrace();
            }
            else
            {
                writer.sb.Append("=null");
            }

            writer.writeEnter();
            writer.writeTabs();
            writer.sb.Append("strArgs");
            writer.sb.Append(':');
            writer.sb.Append("Array<string>");
            if (this.strArgs != null)
            {
                string[] strArgsT   = this.strArgs;
                int      strArgsLen = strArgsT.Length;
                writer.sb.Append('(');
                writer.sb.Append(strArgsLen);
                writer.sb.Append(')');
                writer.writeEnter();
                writer.writeLeftBrace();
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsV = strArgsT[strArgsI];
                    writer.writeTabs();
                    writer.sb.Append(strArgsI);
                    writer.sb.Append(':');
                    writer.sb.Append(strArgsV);

                    writer.writeEnter();
                }
                writer.writeRightBrace();
            }
            else
            {
                writer.sb.Append("=null");
            }

            writer.writeEnter();
        }
コード例 #30
0
        /// <summary>
        /// 读取字节流(完整版)
        /// </summary>
        protected override void toReadBytesFull(BytesReadStream stream)
        {
            stream.startReadObj();

            this.name = stream.readUTF();

            this.type = stream.readInt();

            this.style = stream.readUTF();

            if (stream.readBoolean())
            {
                int childrenLen = stream.readLen();
                if (this.children != null)
                {
                    this.children.clear();
                    this.children.ensureCapacity(childrenLen);
                }
                else
                {
                    this.children = new SList <UIObjectData>();
                }

                SList <UIObjectData> childrenT = this.children;
                for (int childrenI = childrenLen - 1; childrenI >= 0; --childrenI)
                {
                    UIObjectData childrenV;
                    if (stream.readBoolean())
                    {
                        childrenV = (UIObjectData)stream.createData(UIObjectData.dataID);
                        childrenV.readBytesFull(stream);
                    }
                    else
                    {
                        childrenV = null;
                    }

                    childrenT.add(childrenV);
                }
            }
            else
            {
                this.children = null;
            }

            if (stream.readBoolean())
            {
                int intArgsLen = stream.readLen();
                if (this.intArgs == null || this.intArgs.Length != intArgsLen)
                {
                    this.intArgs = new int[intArgsLen];
                }
                int[] intArgsT = this.intArgs;
                for (int intArgsI = 0; intArgsI < intArgsLen; ++intArgsI)
                {
                    int intArgsV;
                    intArgsV = stream.readInt();

                    intArgsT[intArgsI] = intArgsV;
                }
            }
            else
            {
                this.intArgs = null;
            }

            if (stream.readBoolean())
            {
                int strArgsLen = stream.readLen();
                if (this.strArgs == null || this.strArgs.Length != strArgsLen)
                {
                    this.strArgs = new string[strArgsLen];
                }
                string[] strArgsT = this.strArgs;
                for (int strArgsI = 0; strArgsI < strArgsLen; ++strArgsI)
                {
                    string strArgsV;
                    strArgsV = stream.readUTF();

                    strArgsT[strArgsI] = strArgsV;
                }
            }
            else
            {
                this.strArgs = null;
            }

            stream.endReadObj();
        }