Beispiel #1
0
 public FsmGameObject(AssetNameResolver namer, AssetTypeValueField field) : base(field)
 {
     value = StructUtil.ReadNamedAssetPPtr(namer, field.Get("value"));
     if (name == "")
     {
         name = value.name;
     }
 }
Beispiel #2
0
 public FsmEventTarget(AssetNameResolver namer, AssetTypeValueField field)
 {
     target         = (EventTarget)field.Get("target").GetValue().AsInt();
     excludeSelf    = new FsmBool(namer, field.Get("excludeSelf"));
     gameObject     = new FsmOwnerDefault(namer, field.Get("gameObject"));
     fsmName        = new FsmString(namer, field.Get("fsmName"));
     sendToChildren = new FsmBool(namer, field.Get("sendToChildren"));
     fsmComponent   = StructUtil.ReadNamedAssetPPtr(namer, field.Get("fsmComponent"));
 }
Beispiel #3
0
 public FsmVar(AssetNameResolver namer, AssetTypeValueField field)
 {
     variableName    = field.Get("variableName").GetValue().AsString();
     objectType      = field.Get("objectType").GetValue().AsString();
     useVariable     = field.Get("useVariable").GetValue().AsBool();
     type            = (VariableType)field.Get("type").GetValue().AsInt();
     floatValue      = field.Get("floatValue").GetValue().AsFloat();
     intValue        = field.Get("intValue").GetValue().AsInt();
     boolValue       = field.Get("boolValue").GetValue().AsBool();
     stringValue     = field.Get("stringValue").GetValue().AsString();
     vector4Value    = new Vector4(field.Get("vector4Value"));
     objectReference = StructUtil.ReadNamedAssetPPtr(namer, field.Get("objectReference"));
     arrayValue      = new FsmArray(namer, field.Get("arrayValue"));
 }
Beispiel #4
0
        private void GetVariableValues(List <FsmVariableData> varData, AssetNameResolver namer, AssetTypeValueField variables)
        {
            AssetTypeValueField floatVariables      = variables.Get("floatVariables");
            AssetTypeValueField intVariables        = variables.Get("intVariables");
            AssetTypeValueField boolVariables       = variables.Get("boolVariables");
            AssetTypeValueField stringVariables     = variables.Get("stringVariables");
            AssetTypeValueField vector2Variables    = variables.Get("vector2Variables");
            AssetTypeValueField vector3Variables    = variables.Get("vector3Variables");
            AssetTypeValueField colorVariables      = variables.Get("colorVariables");
            AssetTypeValueField rectVariables       = variables.Get("rectVariables");
            AssetTypeValueField quaternionVariables = variables.Get("quaternionVariables");
            AssetTypeValueField gameObjectVariables = variables.Get("gameObjectVariables");
            AssetTypeValueField objectVariables     = variables.Get("objectVariables");
            AssetTypeValueField materialVariables   = variables.Get("materialVariables");
            AssetTypeValueField textureVariables    = variables.Get("textureVariables");
            AssetTypeValueField arrayVariables      = variables.Get("arrayVariables");
            AssetTypeValueField enumVariables       = variables.Get("enumVariables");
            FsmVariableData     floats = new FsmVariableData()
            {
                Type = "Floats", Values = new List <Tuple <string, object> >()
            };

            varData.Add(floats);
            for (int i = 0; i < floatVariables.GetValue().AsArray().size; i++)
            {
                string name  = floatVariables.Get(i).Get("name").GetValue().AsString();
                object value = floatVariables.Get(i).Get("value").GetValue().AsFloat();
                floats.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData ints = new FsmVariableData()
            {
                Type = "Ints", Values = new List <Tuple <string, object> >()
            };

            varData.Add(ints);
            for (int i = 0; i < intVariables.GetValue().AsArray().size; i++)
            {
                string name  = intVariables.Get(i).Get("name").GetValue().AsString();
                object value = intVariables.Get(i).Get("value").GetValue().AsInt();
                ints.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData bools = new FsmVariableData()
            {
                Type = "Bools", Values = new List <Tuple <string, object> >()
            };

            varData.Add(bools);
            for (int i = 0; i < boolVariables.GetValue().AsArray().size; i++)
            {
                string name  = boolVariables.Get(i).Get("name").GetValue().AsString();
                object value = boolVariables.Get(i).Get("value").GetValue().AsBool().ToString();
                bools.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData strings = new FsmVariableData()
            {
                Type = "Strings", Values = new List <Tuple <string, object> >()
            };

            varData.Add(strings);
            for (int i = 0; i < stringVariables.GetValue().AsArray().size; i++)
            {
                string name  = stringVariables.Get(i).Get("name").GetValue().AsString();
                object value = stringVariables.Get(i).Get("value").GetValue().AsString();
                strings.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData vector2s = new FsmVariableData()
            {
                Type = "Vector2s", Values = new List <Tuple <string, object> >()
            };

            varData.Add(vector2s);
            for (int i = 0; i < vector2Variables.GetValue().AsArray().size; i++)
            {
                string name = vector2Variables.Get(i).Get("name").GetValue().AsString();
                AssetTypeValueField vector2 = vector2Variables.Get(i).Get("value");
                object value = new Vector2(vector2);
                vector2s.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData vector3s = new FsmVariableData()
            {
                Type = "Vector3s", Values = new List <Tuple <string, object> >()
            };

            varData.Add(vector3s);
            for (int i = 0; i < vector3Variables.GetValue().AsArray().size; i++)
            {
                string name = vector3Variables.Get(i).Get("name").GetValue().AsString();
                AssetTypeValueField vector3 = vector3Variables.Get(i).Get("value");
                object value = new Vector2(vector3);
                vector3s.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData colors = new FsmVariableData()
            {
                Type = "Colors", Values = new List <Tuple <string, object> >()
            };

            varData.Add(colors);
            for (int i = 0; i < colorVariables.GetValue().AsArray().size; i++)
            {
                string name = colorVariables.Get(i).Get("name").GetValue().AsString();
                AssetTypeValueField color = colorVariables.Get(i).Get("value");
                object value = new UnityColor(color);
                colors.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData rects = new FsmVariableData()
            {
                Type = "Rects", Values = new List <Tuple <string, object> >()
            };

            varData.Add(rects);
            for (int i = 0; i < rectVariables.GetValue().AsArray().size; i++)
            {
                string name = rectVariables.Get(i).Get("name").GetValue().AsString();
                AssetTypeValueField rect = rectVariables.Get(i).Get("value");
                object value             = new UnityRect(rect);
                rects.Values.Add(new Tuple <string, object>(name, value));
            }
            FsmVariableData quaternions = new FsmVariableData()
            {
                Type = "Quaternions", Values = new List <Tuple <string, object> >()
            };

            varData.Add(quaternions);
            for (int i = 0; i < quaternionVariables.GetValue().AsArray().size; i++)
            {
                string name = quaternionVariables.Get(i).Get("name").GetValue().AsString();
                AssetTypeValueField quaternion = quaternionVariables.Get(i).Get("value");
                object value = new Quaternion(quaternion);
                quaternions.Values.Add(new Tuple <string, object>(name, value));
            }
            string[] pptrTypeHeaders             = new[] { "GameObjects", "Objects", "Materials", "Textures" };
            AssetTypeValueField[] pptrTypeFields = new[] { gameObjectVariables, objectVariables, materialVariables, textureVariables };
            for (int j = 0; j < pptrTypeHeaders.Length; j++)
            {
                string header             = pptrTypeHeaders[j];
                AssetTypeValueField field = pptrTypeFields[j];

                if (field.IsDummy())
                {
                    continue;
                }

                FsmVariableData genericData = new FsmVariableData()
                {
                    Type = header, Values = new List <Tuple <string, object> >()
                };
                varData.Add(genericData);
                for (int i = 0; i < field.GetValue().AsArray().size; i++)
                {
                    string name = field.Get(i).Get("name").GetValue().AsString();
                    AssetTypeValueField valueField = field.Get(i).Get("value");
                    NamedAssetPPtr      pptr       = StructUtil.ReadNamedAssetPPtr(namer, valueField);
                    object value;
                    if (pptr.pathID == 0)
                    {
                        value = "[null]";
                    }
                    else
                    {
                        value = pptr;
                    }
                    genericData.Values.Add(new Tuple <string, object>(name, value));
                }
            }
        }
Beispiel #5
0
 public FsmObject(AssetNameResolver namer, AssetTypeValueField field) : base(field)
 {
     value = StructUtil.ReadNamedAssetPPtr(namer, field.Get("value"));
 }