예제 #1
0
        public CfgEncoder Add <T>(string tag, List <T> lst, ListMetaData ld) where T : ICfg
        {
            var cody = new CfgEncoder();

            if (lst != null)
            {
                var indTypes = typeof(T).TryGetDerivedClasses();

                if (indTypes != null)
                {
                    for (var i = 0; i < lst.Count; i++)
                    {
                        var v = lst[i];
                        cody.Add(v, indTypes, ld, i);
                    }
                }
                else
                {
                    foreach (var v in lst)
                    {
                        if (v != null)
                        {
                            cody.Add(CfgDecoder.ListElementTag, v);
                        }
                        else
                        {
                            cody.Add_String(NullTag, "");
                        }
                    }
                }
            }

            return(Add(tag, new CfgEncoder().Add(ListMetaTag, ld).Add(ListTag, cody)));
        }
예제 #2
0
        public CfgEncoder Add_Abstract <T>(string tag, List <T> val, ListMetaData ld) where T : IGotClassTag
        {
            var cody = new CfgEncoder();

            if (val != null)
            {
                if (ld == null)
                {
                    foreach (var v in val)
                    {
                        cody.Add(v.ClassTag, v);
                    }
                }

                else
                {
                    for (var i = 0; i < val.Count; i++)
                    {
                        var v = val[i];
                        cody.Add_Abstract(v, ld, i);
                    }
                }
            }

            Add(tag, new CfgEncoder().Add(ListMetaTag, ld).Add(ListTag, cody));

            return(this);
        }
예제 #3
0
 public static CfgEncoder Encode(this Countless<Quaternion> c)
 {
     var cody = new CfgEncoder();
     List<int> inds;
     List<Quaternion> vals = c.GetAllObjs(out inds);
     for (int i = 0; i < inds.Count; i++)
         cody.Add(inds[i].ToString(), vals[i]);
     return cody;
 }
예제 #4
0
        public CfgEncoder Add(string tag, List <Matrix4x4> val)
        {
            var cody = new CfgEncoder();

            foreach (var i in val)
            {
                cody.Add(CfgDecoder.ListElementTag, i);
            }

            return(Add(tag, cody));
        }
예제 #5
0
 public static CfgEncoder Encode(this Countless<Vector3> c)
 {
     var cody = new CfgEncoder();
     if (c != null)
     {
         List<int> inds;
         List<Vector3> vals = c.GetAllObjs(out inds);
         for (int i = 0; i < inds.Count; i++)
             cody.Add(inds[i].ToString(), vals[i]);
     }
     return cody;
 }
예제 #6
0
            public override CfgEncoder Encode()
            {
                var cody = new CfgEncoder()
                           .Add("b", base.Encode);

                if (allowChangeParameters)
                {
                    cody.Add("t", CurrentValue);
                }

                return(cody);
            }
예제 #7
0
        public static CfgEncoder Encode(this Countless <float> c)
        {
            var          cody = new CfgEncoder();
            List <int>   inds;
            List <float> vals = c.GetAllObjs(out inds);

            for (int i = 0; i < inds.Count; i++)
            {
                cody.Add(inds[i].ToString(), vals[i]);
            }
            return(cody);
        }
예제 #8
0
        public CfgEncoder Encode()
        {
            var cody = new CfgEncoder();

            List <int> indexes;
            var        values = GetAllObjs(out indexes);

            for (var i = 0; i < indexes.Count; i++)
            {
                cody.Add_IfNotEmpty(indexes[i].ToString(), values[i]);
            }

            return(cody);
        }
예제 #9
0
            public override CfgEncoder Encode()
            {
                var cody = new CfgEncoder()
                           .Add("b", base.Encode)
                           .Add("trgf", targetValue)
                           .Add_Bool("rng", minMax);

                if (minMax)
                {
                    cody.Add("min", min)
                    .Add("max", max);
                }

                return(cody);
            }
예제 #10
0
            public override CfgEncoder Encode()
            {
                var cody = new CfgEncoder().Add("b", base.Encode);

                if (allowChangeParameters)
                {
                    cody.Add_IfNotZero("onStart", (int)_onStart);
                    if (_onStart == OnStart.LoadCurrent)
                    {
                        cody.Add_Reference("s", _targetTextures.TryGetLast());
                    }
                }

                return(cody);
            }
예제 #11
0
        public override CfgEncoder Encode()
        {
            List <int> indexes;
            var        values = GetAllObjs(out indexes);

            var cody = new CfgEncoder()
                       .Add("inds", indexes)
                       .Add("vals", values)
                       .Add_IfNotNegative("brws", _edited)
                       .Add("last", lastFreeIndex)
                       .Add_Bool("add", _allowAdd)
                       .Add_Bool("del", _allowDelete);

            return(cody);
        }
예제 #12
0
        public override CfgEncoder Encode()
        {
            var cody = new CfgEncoder();

            if (_tags == null)
            {
                return(cody);
            }

            foreach (var t in _tags)
            {
                cody.Add_String(t.tag, t.data);
            }

            return(cody);
        }
예제 #13
0
        public static CfgEncoder Encode <T>(this Dictionary <string, T> dic) where T : ICfg
        {
            var sub = new CfgEncoder();

            if (dic == null)
            {
                return(sub);
            }

            foreach (var e in dic)
            {
                sub.Add(e.Key, e.Value.Encode());
            }

            return(sub);
        }
예제 #14
0
        public static CfgEncoder Encode(this Dictionary <int, string> dic)
        {
            var sub = new CfgEncoder();

            if (dic == null)
            {
                return(sub);
            }

            foreach (var e in dic)
            {
                sub.Add_String(e.Key.ToString(), e.Value);
            }

            return(sub);
        }
예제 #15
0
        public static CfgEncoder Encode(this Dictionary <string, CfgData> dic)
        {
            var sub = new CfgEncoder();

            if (dic == null)
            {
                return(sub);
            }

            foreach (var e in dic)
            {
                sub.Add(e.Key, e.Value);
            }

            return(sub);
        }
예제 #16
0
        public CfgEncoder Add(string tag, Dictionary <int, string> dic)
        {
            var sub = new CfgEncoder();

            if (dic == null)
            {
                return(this);
            }

            foreach (var e in dic)
            {
                sub.Add_String(e.Key.ToString(), e.Value);
            }

            return(Add(tag, sub));
        }
예제 #17
0
        public CfgEncoder Add_IfNotEmpty <T>(string tag, List <List <T> > lst) where T : ICfg, new()
        {
            if (lst.IsNullOrEmpty())
            {
                return(this);
            }

            var sub = new CfgEncoder();

            foreach (var l in lst)
            {
                sub.Add_IfNotEmpty(CfgDecoder.ListElementTag, l);
            }

            return(Add_String(tag, sub.ToString()));
        }
예제 #18
0
        public CfgEncoder Add(string tag, List <string> lst)
        {
            if (lst == null)
            {
                return(this);
            }

            var cody = new CfgEncoder();

            foreach (var s in lst)
            {
                cody.Add_String(CfgDecoder.ListElementTag, s);
            }

            return(Add(tag, cody));
        }
예제 #19
0
        public override CfgEncoder Encode()
        {
            var cody = new CfgEncoder();

            List <int> values;

            GetItAll(out inds, out values);

            cody.Add("inds", inds);
            cody.Add("vals", values);
            cody.Add("last", lastFreeIndex);


            inds = null;

            return(cody);
        }
예제 #20
0
        public CfgEncoder Add(string tag, Matrix4x4[] arr)
        {
            if (arr == null)
            {
                return(this);
            }

            var cody = new CfgEncoder()
                       .Add("len", arr.Length);

            foreach (var v in arr)
            {
                cody.Add(CfgDecoder.ListElementTag, v.Encode());
            }

            return(Add(tag, cody));
        }
예제 #21
0
        public CfgEncoder Encode()
        {
            var cody = new CfgEncoder()
                       .Add_IfNotNegative("insp", inspected)
                       .Add_IfNotNegative("pi", previousInspected)
                       .Add_IfNotZero("st", listSectionStartIndex)
                       .Add_IfTrue("adl", allowDuplicants)
                       .Add_IfNotDefault("s", searchData)
            ;

            if (!folderToSearch.SameAs(DefaultFolderToSearch))
            {
                cody.Add_String("fld", folderToSearch);
            }

            return(cody);
        }
예제 #22
0
        public static CfgEncoder Encode(this IEnumerable <UnrecognizedTagsList.UnrecognizedElement> lst)
        {
            var cody = new CfgEncoder();

            foreach (var e in lst)
            {
                if (e.elements.Count == 0)
                {
                    cody.Add_String(e.tag, e.data);
                }
                else
                {
                    cody.Add(e.tag, e.elements.Encode());
                }
            }

            return(cody);
        }
예제 #23
0
        public override CfgEncoder Encode()
        {
            var cody = new CfgEncoder()
                       .Add_IfNotNegative("insp", inspected)
                       .Add_IfNotNegative("pi", previousInspected)
                       .Add_IfNotZero("st", listSectionStartIndex)
                #if !NO_PEGI
                       .Add_IfNotDefault("s", searchData)
                #endif
            ;

            if (!folderToSearch.SameAs(DefaultFolderToSearch))
            {
                cody.Add_String("fld", folderToSearch);
            }

            cody.Add_IfNotDefault("ed", elementDatas);

            return(cody);
        }
예제 #24
0
        public static CfgEncoder Encode(this Transform tf, bool local)
        {
            var cody = new CfgEncoder();

            cody.Add_Bool("loc", local);

            if (local)
            {
                cody.Add("pos", tf.localPosition);
                cody.Add("size", tf.localScale);
                cody.Add("rot", tf.localRotation);
            }
            else
            {
                cody.Add("pos", tf.position);
                cody.Add("size", tf.localScale);
                cody.Add("rot", tf.rotation);
            }

            return(cody);
        }
예제 #25
0
            public override CfgEncoder Encode()
            {
                var cody = new CfgEncoder()
                           .Add_Bool("ch", allowChangeParameters);

                if (allowChangeParameters)
                {
                    if (EaseInOutImplemented)
                    {
                        cody.Add_Bool("eio", easeInOut);
                    }

                    cody.Add("lm", (int)lerpMode);

                    if (lerpMode == LerpSpeedMode.SpeedThreshold)
                    {
                        cody.Add("sp", speedLimit);
                    }
                }

                return(cody);
            }
예제 #26
0
        public override CfgEncoder Encode()
        {
            var cody = new CfgEncoder()
                       .Add_IfNotEmpty("n", name)
                       .Add_IfNotEmpty("cfg", stdDta);

            if (!_guid.IsNullOrEmpty())
            {
                cody.Add_IfNotEmpty("guid", _guid)
                .Add_IfNotEmpty("t", componentType);
            }

            cody.Add_IfNotEmpty("perType", _perTypeConfig)
            .Add_IfTrue("sel", selected);

            if (unrecognized)
            {
                cody.Add_Bool("ur", unrecognized)
                .Add_String("tag", unrecognizedUnderTag);
            }
            return(cody);
        }
예제 #27
0
        public static CfgEncoder Encode <T>(this T[] arr) where T : ICfg
        {
            var cody = new CfgEncoder();

            if (arr.IsNullOrEmpty())
            {
                return(cody);
            }

            cody.Add("len", arr.Length);

            var types = typeof(T).TryGetDerivedClasses();

            if (types != null && types.Count > 0)
            {
                foreach (var v in arr)
                {
                    cody.Add(v, types);
                }
            }
            else
            {
                foreach (var v in arr)
                {
                    if (!QcUnity.IsNullOrDestroyed_Obj(v))
                    {
                        cody.Add(CfgDecoder.ListElementTag, v.Encode());
                    }
                    else
                    {
                        cody.Add_String(CfgEncoder.NullTag, "");
                    }
                }
            }

            return(cody);
        }
예제 #28
0
        public CfgEncoder Add <T>(string tag, List <T> lst) where T : ICfg, new()
        {
            var cody = new CfgEncoder();

            if (lst == null)
            {
                return(this);
            }

            var indTypes = typeof(T).TryGetDerivedClasses();

            if (indTypes != null)
            {
                foreach (var v in lst)
                {
                    cody.Add(v, indTypes);
                }
            }
            else
            {
                foreach (var v in lst)
                {
                    if (v != null)
                    {
                        cody.Add(CfgDecoder.ListElementTag, v.Encode());
                    }
                    else
                    {
                        cody.Add_String(NullTag, "");
                    }
                }
            }


            return(Add(tag, cody));
        }
예제 #29
0
        public CfgEncoder Add_Abstract <T>(string tag, List <T> lst) where T : IGotClassTag
        {
            if (lst.IsNullOrEmpty())
            {
                return(this);
            }

            var cody = new CfgEncoder();

            foreach (var v in lst)
            {
                if (v != null)
                {
                    cody.Add(v.ClassTag, v);
                }
                else
                {
                    cody.Add_String(NullTag, "");
                }
            }


            return(Add(tag, cody));
        }
예제 #30
0
 public CfgEncoder Add(string tag, CfgEncoder cody) => cody == null ? this : Add_String(tag, cody.ToString());