123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using UnityEngine;
- using wf;
- [Serializable]
- public class AMEventParameter : ScriptableObject
- {
- public bool setBool(bool val_bool)
- {
- if (this.val_bool != val_bool)
- {
- this.val_bool = val_bool;
- return true;
- }
- return false;
- }
- public bool setInt(int val_int)
- {
- if (this.val_int != val_int)
- {
- this.val_int = val_int;
- return true;
- }
- return false;
- }
- public bool setFloat(float val_float)
- {
- if (this.val_float != val_float)
- {
- this.val_float = val_float;
- return true;
- }
- return false;
- }
- public bool setVector2(Vector2 val_vect2)
- {
- if (this.val_vect2 != val_vect2)
- {
- this.val_vect2 = val_vect2;
- return true;
- }
- return false;
- }
- public bool setVector3(Vector3 val_vect3)
- {
- if (this.val_vect3 != val_vect3)
- {
- this.val_vect3 = val_vect3;
- return true;
- }
- return false;
- }
- public bool setVector4(Vector4 val_vect4)
- {
- if (this.val_vect4 != val_vect4)
- {
- this.val_vect4 = val_vect4;
- return true;
- }
- return false;
- }
- public bool setColor(Color val_color)
- {
- if (this.val_color != val_color)
- {
- this.val_color = val_color;
- return true;
- }
- return false;
- }
- public bool setRect(Rect val_rect)
- {
- if (this.val_rect != val_rect)
- {
- this.val_rect = val_rect;
- return true;
- }
- return false;
- }
- public bool setString(string val_string)
- {
- if (this.val_string != val_string)
- {
- this.val_string = val_string;
- return true;
- }
- return false;
- }
- public bool setObject(UnityEngine.Object val_obj)
- {
- if (this.val_obj != val_obj)
- {
- this.val_obj = val_obj;
- return true;
- }
- return false;
- }
- public Type getParamType()
- {
- if (this.valueType == 13)
- {
- return typeof(bool);
- }
- if (this.valueType == 0 || this.valueType == 1)
- {
- return typeof(int);
- }
- if (this.valueType == 2 || this.valueType == 3)
- {
- return typeof(float);
- }
- if (this.valueType == 4)
- {
- return typeof(Vector2);
- }
- if (this.valueType == 5)
- {
- return typeof(Vector3);
- }
- if (this.valueType == 6)
- {
- return typeof(Vector4);
- }
- if (this.valueType == 7)
- {
- return typeof(Color);
- }
- if (this.valueType == 8)
- {
- return typeof(Rect);
- }
- if (this.valueType == 11)
- {
- return typeof(UnityEngine.Object);
- }
- if (this.valueType == 12)
- {
- if (this.lsArray.Count <= 0)
- {
- return typeof(object[]);
- }
- return this.lsArray[0].getParamType();
- }
- else
- {
- if (this.valueType == 9)
- {
- return typeof(string);
- }
- if (this.valueType == 10)
- {
- return typeof(char);
- }
- Debug.LogError("Animator: Type not found for Event Parameter.");
- return typeof(object);
- }
- }
- public void destroy()
- {
- foreach (AMEventParameter ameventParameter in this.lsArray)
- {
- ameventParameter.destroy();
- }
- UnityEngine.Object.DestroyImmediate(this);
- }
- public string getStringValue()
- {
- if (this.valueType == 13)
- {
- return this.val_bool.ToString().ToLower();
- }
- if (this.valueType == 9)
- {
- return "\"" + this.val_string + "\"";
- }
- if (this.valueType == 10)
- {
- if (this.val_string == null || this.val_string.Length <= 0)
- {
- return "''";
- }
- return "'" + this.val_string[0] + "'";
- }
- else
- {
- if (this.valueType == 0 || this.valueType == 1)
- {
- return this.val_int.ToString();
- }
- if (this.valueType == 2 || this.valueType == 3)
- {
- return this.val_float.ToString();
- }
- if (this.valueType == 4)
- {
- return this.val_vect2.ToString();
- }
- if (this.valueType == 5)
- {
- return this.val_vect3.ToString();
- }
- if (this.valueType == 6)
- {
- return this.val_vect4.ToString();
- }
- if (this.valueType == 7)
- {
- return this.val_color.ToString();
- }
- if (this.valueType == 8)
- {
- return this.val_rect.ToString();
- }
- if (this.valueType == 11)
- {
- if (!this.val_obj)
- {
- return "None";
- }
- return this.val_obj.name;
- }
- else
- {
- if (this.valueType == 12)
- {
- return "Array";
- }
- Debug.LogError("Animator: Type not found for Event Parameter.");
- return "object";
- }
- }
- }
- public void setValueType(Type t)
- {
- if (t == typeof(bool))
- {
- this.valueType = 13;
- }
- else if (t == typeof(string))
- {
- this.valueType = 9;
- }
- else if (t == typeof(char))
- {
- this.valueType = 10;
- }
- else if (t == typeof(int))
- {
- this.valueType = 0;
- }
- else if (t == typeof(long))
- {
- this.valueType = 1;
- }
- else if (t == typeof(float))
- {
- this.valueType = 2;
- }
- else if (t == typeof(double))
- {
- this.valueType = 3;
- }
- else if (t == typeof(Vector2))
- {
- this.valueType = 4;
- }
- else if (t == typeof(Vector3))
- {
- this.valueType = 5;
- }
- else if (t == typeof(Vector4))
- {
- this.valueType = 6;
- }
- else if (t == typeof(Color))
- {
- this.valueType = 7;
- }
- else if (t == typeof(Rect))
- {
- this.valueType = 8;
- }
- else if (t.IsArray)
- {
- this.valueType = 12;
- }
- else if (t.BaseType.BaseType == typeof(UnityEngine.Object))
- {
- this.valueType = 11;
- }
- else
- {
- this.valueType = 11;
- }
- }
- public object toObject()
- {
- if (this.valueType == 13)
- {
- return this.val_bool;
- }
- if (this.valueType == 9)
- {
- return this.val_string;
- }
- if (this.valueType == 10)
- {
- if (this.val_string == null || this.val_string.Length <= 0)
- {
- return '\0';
- }
- return this.val_string[0];
- }
- else
- {
- if (this.valueType == 0 || this.valueType == 1)
- {
- return this.val_int;
- }
- if (this.valueType == 2 || this.valueType == 3)
- {
- return this.val_float;
- }
- if (this.valueType == 4)
- {
- return this.val_vect2;
- }
- if (this.valueType == 5)
- {
- return this.val_vect3;
- }
- if (this.valueType == 6)
- {
- return this.val_vect4;
- }
- if (this.valueType == 7)
- {
- return this.val_color;
- }
- if (this.valueType == 8)
- {
- return this.val_rect;
- }
- if (this.valueType == 11)
- {
- return this.val_obj;
- }
- if (this.valueType == 12 && this.lsArray.Count > 0)
- {
- if (this.lsArray[0].valueType == 13)
- {
- bool[] array = new bool[this.lsArray.Count];
- for (int i = 0; i < this.lsArray.Count; i++)
- {
- array[i] = this.lsArray[i].val_bool;
- }
- return array;
- }
- if (this.lsArray[0].valueType == 9)
- {
- string[] array2 = new string[this.lsArray.Count];
- for (int j = 0; j < this.lsArray.Count; j++)
- {
- array2[j] = this.lsArray[j].val_string;
- }
- return array2;
- }
- if (this.lsArray[0].valueType == 10)
- {
- char[] array3 = new char[this.lsArray.Count];
- for (int k = 0; k < this.lsArray.Count; k++)
- {
- array3[k] = this.lsArray[k].val_string[0];
- }
- return array3;
- }
- if (this.lsArray[0].valueType == 0 || this.lsArray[0].valueType == 1)
- {
- int[] array4 = new int[this.lsArray.Count];
- for (int l = 0; l < this.lsArray.Count; l++)
- {
- array4[l] = this.lsArray[l].val_int;
- }
- return array4;
- }
- if (this.lsArray[0].valueType == 2 || this.lsArray[0].valueType == 3)
- {
- float[] array5 = new float[this.lsArray.Count];
- for (int m = 0; m < this.lsArray.Count; m++)
- {
- array5[m] = this.lsArray[m].val_float;
- }
- return array5;
- }
- if (this.lsArray[0].valueType == 4)
- {
- Vector2[] array6 = new Vector2[this.lsArray.Count];
- for (int n = 0; n < this.lsArray.Count; n++)
- {
- array6[n] = this.lsArray[n].val_vect2;
- }
- return array6;
- }
- if (this.lsArray[0].valueType == 5)
- {
- Vector3[] array7 = new Vector3[this.lsArray.Count];
- for (int num = 0; num < this.lsArray.Count; num++)
- {
- array7[num] = this.lsArray[num].val_vect3;
- }
- return array7;
- }
- if (this.lsArray[0].valueType == 6)
- {
- Vector4[] array8 = new Vector4[this.lsArray.Count];
- for (int num2 = 0; num2 < this.lsArray.Count; num2++)
- {
- array8[num2] = this.lsArray[num2].val_vect4;
- }
- return array8;
- }
- if (this.lsArray[0].valueType == 7)
- {
- Color[] array9 = new Color[this.lsArray.Count];
- for (int num3 = 0; num3 < this.lsArray.Count; num3++)
- {
- array9[num3] = this.lsArray[num3].val_color;
- }
- return array9;
- }
- if (this.lsArray[0].valueType == 8)
- {
- Rect[] array10 = new Rect[this.lsArray.Count];
- for (int num4 = 0; num4 < this.lsArray.Count; num4++)
- {
- array10[num4] = this.lsArray[num4].val_rect;
- }
- return array10;
- }
- if (this.lsArray[0].valueType == 11)
- {
- UnityEngine.Object[] array11 = new UnityEngine.Object[this.lsArray.Count];
- for (int num5 = 0; num5 < this.lsArray.Count; num5++)
- {
- array11[num5] = this.lsArray[num5].val_obj;
- }
- return array11;
- }
- }
- Debug.LogError("Animator: Type not found for Event Parameter.");
- return null;
- }
- }
- public AnimatorTimeline.JSONEventParameter toJSON()
- {
- AnimatorTimeline.JSONEventParameter jsoneventParameter = new AnimatorTimeline.JSONEventParameter();
- jsoneventParameter.valueType = this.valueType;
- if (this.valueType == 13)
- {
- jsoneventParameter.val_bool = this.val_bool;
- }
- if (this.valueType == 9)
- {
- jsoneventParameter.val_string = this.val_string;
- }
- if (this.valueType == 10)
- {
- if (this.val_string == null || this.val_string.Length <= 0)
- {
- jsoneventParameter.val_string = "\0";
- }
- jsoneventParameter.val_string = string.Empty + this.val_string[0];
- }
- if (this.valueType == 0 || this.valueType == 1)
- {
- jsoneventParameter.val_int = this.val_int;
- }
- if (this.valueType == 2 || this.valueType == 3)
- {
- jsoneventParameter.val_float = this.val_float;
- }
- if (this.valueType == 4)
- {
- AnimatorTimeline.JSONVector2 jsonvector = new AnimatorTimeline.JSONVector2();
- jsonvector.setValue(this.val_vect2);
- jsoneventParameter.val_vect2 = jsonvector;
- }
- if (this.valueType == 5)
- {
- AnimatorTimeline.JSONVector3 jsonvector2 = new AnimatorTimeline.JSONVector3();
- jsonvector2.setValue(this.val_vect3);
- jsoneventParameter.val_vect3 = jsonvector2;
- }
- if (this.valueType == 6)
- {
- AnimatorTimeline.JSONVector4 jsonvector3 = new AnimatorTimeline.JSONVector4();
- jsonvector3.setValue(this.val_vect4);
- jsoneventParameter.val_vect4 = jsonvector3;
- }
- if (this.valueType == 7)
- {
- AnimatorTimeline.JSONColor jsoncolor = new AnimatorTimeline.JSONColor();
- jsoncolor.setValue(this.val_color);
- jsoneventParameter.val_color = jsoncolor;
- }
- if (this.valueType == 8)
- {
- AnimatorTimeline.JSONRect jsonrect = new AnimatorTimeline.JSONRect();
- jsonrect.setValue(this.val_rect);
- jsoneventParameter.val_rect = jsonrect;
- }
- if (this.valueType == 11)
- {
- if (this.val_obj.GetType() != typeof(GameObject))
- {
- jsoneventParameter.val_obj_extra = this.val_obj.name;
- jsoneventParameter.val_obj = this.val_obj.GetType().Name;
- }
- else
- {
- jsoneventParameter.val_obj_extra = null;
- jsoneventParameter.val_obj = this.val_obj.name;
- }
- }
- if (this.valueType == 12 && this.lsArray.Count > 0)
- {
- AnimatorTimeline.JSONEventParameter[] array = new AnimatorTimeline.JSONEventParameter[this.lsArray.Count];
- for (int i = 0; i < this.lsArray.Count; i++)
- {
- array[i] = this.lsArray[i].toJSON();
- }
- jsoneventParameter.array = array;
- }
- return jsoneventParameter;
- }
- public object[] toArray()
- {
- object[] array = new object[this.lsArray.Count];
- for (int i = 0; i < this.lsArray.Count; i++)
- {
- array[i] = this.lsArray[i].toObject();
- }
- return array;
- }
- public bool isArray()
- {
- return this.lsArray.Count > 0;
- }
- public AMEventParameter CreateClone()
- {
- AMEventParameter ameventParameter = ScriptableObject.CreateInstance<AMEventParameter>();
- ameventParameter.val_bool = this.val_bool;
- ameventParameter.valueType = this.valueType;
- ameventParameter.val_int = this.val_int;
- ameventParameter.val_float = this.val_float;
- ameventParameter.val_vect2 = this.val_vect2;
- ameventParameter.val_vect3 = this.val_vect3;
- ameventParameter.val_vect4 = this.val_vect4;
- ameventParameter.val_color = this.val_color;
- ameventParameter.val_rect = this.val_rect;
- ameventParameter.val_string = this.val_string;
- ameventParameter.val_obj = this.val_obj;
- foreach (AMEventParameter ameventParameter2 in this.lsArray)
- {
- ameventParameter.lsArray.Add(ameventParameter2.CreateClone());
- }
- return ameventParameter;
- }
- public static AMEventParameter CreateFromStringData(string data_text)
- {
- AMEventParameter ameventParameter = ScriptableObject.CreateInstance<AMEventParameter>();
- string @string = Encoding.GetEncoding("UTF-8").GetString(Convert.FromBase64String(data_text));
- string[] array = @string.Split(new char[]
- {
- ':'
- });
- int num = 0;
- ameventParameter.val_bool = bool.Parse(array[num++]);
- ameventParameter.valueType = int.Parse(array[num++]);
- ameventParameter.val_int = int.Parse(array[num++]);
- ameventParameter.val_float = float.Parse(array[num++]);
- ameventParameter.val_vect2 = Parse.Vector2(array[num++]);
- ameventParameter.val_vect3 = Parse.Vector3(array[num++]);
- ameventParameter.val_vect4 = Parse.Vector4(array[num++]);
- ameventParameter.val_color = Parse.Color(array[num++]);
- ameventParameter.val_rect = default(Rect);
- ameventParameter.val_rect.x = float.Parse(array[num++]);
- ameventParameter.val_rect.y = float.Parse(array[num++]);
- ameventParameter.val_rect.width = float.Parse(array[num++]);
- ameventParameter.val_rect.height = float.Parse(array[num++]);
- ameventParameter.val_string = array[num++];
- ameventParameter.val_obj = null;
- ameventParameter.lsArray.Clear();
- int num2 = int.Parse(array[num++]);
- for (int i = 0; i < num2; i++)
- {
- ameventParameter.lsArray.Add(AMEventParameter.CreateFromStringData(array[num++]));
- }
- return ameventParameter;
- }
- public string ToStringData()
- {
- List<string> list = new List<string>();
- list.Add(this.val_bool.ToString());
- list.Add(this.valueType.ToString());
- list.Add(this.val_int.ToString());
- list.Add(this.val_float.ToString());
- list.Add(this.val_vect2.ToString("G"));
- list.Add(this.val_vect3.ToString("G"));
- list.Add(this.val_vect4.ToString("G"));
- list.Add(this.val_color.ToString("G"));
- list.Add(this.val_rect.x.ToString());
- list.Add(this.val_rect.y.ToString());
- list.Add(this.val_rect.width.ToString());
- list.Add(this.val_rect.height.ToString());
- list.Add(this.val_string);
- if (this.val_obj != null)
- {
- Debug.LogError("AMEventParameter::ToStringData\nオブジェクトの引数には対応していません\nnullで処理します");
- }
- list.Add(this.lsArray.Count.ToString());
- for (int i = 0; i < this.lsArray.Count; i++)
- {
- list.Add(this.lsArray[i].ToStringData());
- }
- string text = list[0];
- for (int j = 1; j < list.Count; j++)
- {
- text = text + ":" + list[j];
- }
- return Convert.ToBase64String(Encoding.GetEncoding("UTF-8").GetBytes(text));
- }
- public List<GameObject> getDependencies()
- {
- List<GameObject> list = new List<GameObject>();
- if (this.valueType == 11 && this.val_obj)
- {
- if (this.val_obj is GameObject)
- {
- list.Add((GameObject)this.val_obj);
- }
- else
- {
- list.Add((this.val_obj as Component).gameObject);
- }
- }
- else if (this.valueType == 12 && this.lsArray.Count > 0 && this.lsArray[0].valueType == 11)
- {
- foreach (AMEventParameter ameventParameter in this.lsArray)
- {
- if (ameventParameter.val_obj)
- {
- if (ameventParameter.val_obj is GameObject)
- {
- list.Add((GameObject)ameventParameter.val_obj);
- }
- else
- {
- list.Add((ameventParameter.val_obj as Component).gameObject);
- }
- }
- }
- }
- return list;
- }
- public bool updateDependencies(List<GameObject> newReferences, List<GameObject> oldReferences)
- {
- bool result = false;
- if (this.valueType == 11 && this.val_obj)
- {
- for (int i = 0; i < oldReferences.Count; i++)
- {
- if (this.val_obj is GameObject)
- {
- if (oldReferences[i] == this.val_obj)
- {
- this.val_obj = newReferences[i];
- result = true;
- break;
- }
- }
- else if (oldReferences[i] == (this.val_obj as Component).gameObject)
- {
- this.val_obj = newReferences[i].GetComponent(this.val_obj.GetType());
- result = true;
- break;
- }
- }
- }
- else if (this.valueType == 12 && this.lsArray.Count > 0 && this.lsArray[0].valueType == 11)
- {
- for (int j = 0; j < oldReferences.Count; j++)
- {
- foreach (AMEventParameter ameventParameter in this.lsArray)
- {
- if (ameventParameter.val_obj)
- {
- if (ameventParameter.val_obj is GameObject)
- {
- if (oldReferences[j] == ameventParameter.val_obj)
- {
- ameventParameter.val_obj = newReferences[j];
- result = true;
- break;
- }
- }
- else if (oldReferences[j] == (ameventParameter.val_obj as Component).gameObject)
- {
- ameventParameter.val_obj = newReferences[j].GetComponent(ameventParameter.val_obj.GetType());
- result = true;
- break;
- }
- }
- }
- }
- }
- return result;
- }
- public void Write(BinaryWriter binary)
- {
- binary.Write(this.valueType);
- if (this.isArray())
- {
- binary.Write(this.lsArray.Count);
- for (int i = 0; i < this.lsArray.Count; i++)
- {
- this.lsArray[i].Write(binary);
- }
- }
- else
- {
- AMEventParameter.ValueType valueType = (AMEventParameter.ValueType)this.valueType;
- if (valueType == AMEventParameter.ValueType.Integer || valueType == AMEventParameter.ValueType.Long)
- {
- binary.Write(this.val_int);
- }
- else if (valueType == AMEventParameter.ValueType.Float || valueType == AMEventParameter.ValueType.Double)
- {
- binary.Write(this.val_float);
- }
- else if (valueType == AMEventParameter.ValueType.Vector2)
- {
- binary.Write(this.val_vect2.x);
- binary.Write(this.val_vect2.y);
- }
- else if (valueType == AMEventParameter.ValueType.Vector3)
- {
- binary.Write(this.val_vect3.x);
- binary.Write(this.val_vect3.y);
- binary.Write(this.val_vect3.z);
- }
- else if (valueType == AMEventParameter.ValueType.Vector4)
- {
- binary.Write(this.val_vect4.x);
- binary.Write(this.val_vect4.y);
- binary.Write(this.val_vect4.z);
- binary.Write(this.val_vect4.w);
- }
- else if (valueType == AMEventParameter.ValueType.Color)
- {
- binary.Write(this.val_color.a);
- binary.Write(this.val_color.r);
- binary.Write(this.val_color.g);
- binary.Write(this.val_color.b);
- }
- else if (valueType == AMEventParameter.ValueType.Rect)
- {
- binary.Write(this.val_rect.xMin);
- binary.Write(this.val_rect.xMax);
- binary.Write(this.val_rect.yMin);
- binary.Write(this.val_rect.yMax);
- }
- else if (valueType == AMEventParameter.ValueType.String || valueType == AMEventParameter.ValueType.Char)
- {
- if (this.val_string == null)
- {
- this.val_string = string.Empty;
- }
- binary.Write(this.val_string);
- }
- else if (valueType == AMEventParameter.ValueType.Boolean)
- {
- binary.Write(this.val_bool);
- }
- else if (valueType == AMEventParameter.ValueType.Object)
- {
- string value = string.Empty;
- GameObject gameObject = this.val_obj as GameObject;
- NDebug.Assert(gameObject != null, "AMEventParameter error type.");
- value = UTY.GetObjectTreePath(gameObject);
- binary.Write(value);
- }
- }
- }
- public void Read(BinaryReader binary)
- {
- this.val_bool = false;
- this.valueType = 0;
- this.val_int = 0;
- this.val_float = 0f;
- this.val_vect2 = Vector2.zero;
- this.val_vect3 = Vector3.zero;
- this.val_vect4 = Vector4.zero;
- this.val_color = default(Color);
- this.val_rect = default(Rect);
- this.val_string = null;
- this.val_obj = null;
- this.lsArray.Clear();
- this.valueType = binary.ReadInt32();
- if (this.valueType == 12)
- {
- int num = binary.ReadInt32();
- for (int i = 0; i < num; i++)
- {
- AMEventParameter ameventParameter = new AMEventParameter();
- ameventParameter.Read(binary);
- this.lsArray.Add(ameventParameter);
- }
- }
- else
- {
- AMEventParameter.ValueType valueType = (AMEventParameter.ValueType)this.valueType;
- if (valueType == AMEventParameter.ValueType.Integer || valueType == AMEventParameter.ValueType.Long)
- {
- this.val_int = binary.ReadInt32();
- }
- else if (valueType == AMEventParameter.ValueType.Float || valueType == AMEventParameter.ValueType.Double)
- {
- this.val_float = binary.ReadSingle();
- }
- else if (valueType == AMEventParameter.ValueType.Vector2)
- {
- this.val_vect2.x = binary.ReadSingle();
- this.val_vect2.y = binary.ReadSingle();
- }
- else if (valueType == AMEventParameter.ValueType.Vector3)
- {
- this.val_vect3.x = binary.ReadSingle();
- this.val_vect3.y = binary.ReadSingle();
- this.val_vect3.z = binary.ReadSingle();
- }
- else if (valueType == AMEventParameter.ValueType.Vector4)
- {
- this.val_vect4.x = binary.ReadSingle();
- this.val_vect4.y = binary.ReadSingle();
- this.val_vect4.z = binary.ReadSingle();
- this.val_vect4.w = binary.ReadSingle();
- }
- else if (valueType == AMEventParameter.ValueType.Color)
- {
- this.val_color.a = binary.ReadSingle();
- this.val_color.r = binary.ReadSingle();
- this.val_color.g = binary.ReadSingle();
- this.val_color.b = binary.ReadSingle();
- }
- else if (valueType == AMEventParameter.ValueType.Rect)
- {
- this.val_rect.xMin = binary.ReadSingle();
- this.val_rect.xMax = binary.ReadSingle();
- this.val_rect.yMin = binary.ReadSingle();
- this.val_rect.yMax = binary.ReadSingle();
- }
- else if (valueType == AMEventParameter.ValueType.String || valueType == AMEventParameter.ValueType.Char)
- {
- this.val_string = binary.ReadString();
- }
- else if (valueType == AMEventParameter.ValueType.Boolean)
- {
- this.val_bool = binary.ReadBoolean();
- }
- else if (valueType == AMEventParameter.ValueType.Object)
- {
- string name = binary.ReadString();
- this.val_obj = GameObject.Find(name);
- }
- }
- }
- public bool val_bool;
- public int valueType;
- public int val_int;
- public float val_float;
- public Vector2 val_vect2;
- public Vector3 val_vect3;
- public Vector4 val_vect4;
- public Color val_color;
- public Rect val_rect;
- public string val_string;
- public UnityEngine.Object val_obj;
- public List<AMEventParameter> lsArray = new List<AMEventParameter>();
- public enum ValueType
- {
- Integer,
- Long,
- Float,
- Double,
- Vector2,
- Vector3,
- Vector4,
- Color,
- Rect,
- String,
- Char,
- Object,
- Array,
- Boolean
- }
- }
|