Example #1
0
        public void Add(Key1 keyOne, Key2 keyTwo, Value value)
        {
            List <Value> valOne;

            if (!dictOne.TryGetValue(keyOne, out valOne))
            {
                valOne          = new List <Value>();
                dictOne[keyOne] = valOne;
            }
            valOne.Add(value);

            List <Value> valTwo;

            if (!dictTwo.TryGetValue(keyTwo, out valTwo))
            {
                valTwo          = new List <Value>();
                dictTwo[keyTwo] = valTwo;
            }
            valTwo.Add(value);


            Key3         key = new Key3(keyOne, keyTwo);
            List <Value> valThree;

            if (!dictThree.TryGetValue(key, out valThree))
            {
                valThree       = new List <Value>();
                dictThree[key] = valThree;
            }
            valThree.Add(value);
        }
Example #2
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add("key0", Key0.ExportYAML(container));
            node.Add("key1", Key1.ExportYAML(container));
            node.Add("key2", Key2.ExportYAML(container));
            node.Add("key3", Key3.ExportYAML(container));
            node.Add("key4", Key4.ExportYAML(container));
            node.Add("key5", Key5.ExportYAML(container));
            node.Add("key6", Key6.ExportYAML(container));
            node.Add("key7", Key7.ExportYAML(container));
            node.Add("ctime0", Ctime0);
            node.Add("ctime1", Ctime1);
            node.Add("ctime2", Ctime2);
            node.Add("ctime3", Ctime3);
            node.Add("ctime4", Ctime4);
            node.Add("ctime5", Ctime5);
            node.Add("ctime6", Ctime6);
            node.Add("ctime7", Ctime7);
            node.Add("atime0", Atime0);
            node.Add("atime1", Atime1);
            node.Add("atime2", Atime2);
            node.Add("atime3", Atime3);
            node.Add("atime4", Atime4);
            node.Add("atime5", Atime5);
            node.Add("atime6", Atime6);
            node.Add("atime7", Atime7);
            node.Add("m_Mode", (int)Mode);
            node.Add("m_NumColorKeys", NumColorKeys);
            node.Add("m_NumAlphaKeys", NumAlphaKeys);
            return(node);
        }
 /// <summary>
 /// オブジェクトが等しいかどうか調べます。
 /// </summary>
 /// <param name="o">
 /// 比較対象のオブジェクトです。
 /// </param>
 /// <returns>
 /// オブジェクトが等しければtrue、そうではないのならfalseです。
 /// </returns>
 public bool Equals(CompositeKey <KEY1_T, KEY2_T, KEY3_T, KEY4_T, KEY5_T> o)
 {
     if (o == null || GetType() != o.GetType())
     {
         return(false);
     }
     if (!Key1.Equals(o.Key1))
     {
         return(false);
     }
     if (!Key2.Equals(o.Key2))
     {
         return(false);
     }
     if (!Key3.Equals(o.Key3))
     {
         return(false);
     }
     if (!Key4.Equals(o.Key4))
     {
         return(false);
     }
     if (!Key5.Equals(o.Key5))
     {
         return(false);
     }
     return(true);
 }
Example #4
0
        /// <summary>
        /// オブジェクトの大小を比較します。
        /// </summary>
        /// <param name="o">
        /// 比較対象のオブジェクトです。
        /// </param>
        /// <returns>
        /// このオブジェクトがoより大きいならば正の値、oと等しいならば0、oより小さいならば負の値を返します。
        /// </returns>
        public int CompareTo(ComparableCompositeKey <KEY1_T, KEY2_T, KEY3_T> o)
        {
            if (o == null)
            {
                return(1);
            }
            if (GetType() != o.GetType())
            {
                throw (new ArgumentException());
            }
            int c;

            if ((c = Key1.CompareTo(o.Key1)) != 0)
            {
                return(c);
            }
            if ((c = Key2.CompareTo(o.Key2)) != 0)
            {
                return(c);
            }
            if ((c = Key3.CompareTo(o.Key3)) != 0)
            {
                return(c);
            }
            return(0);
        }
Example #5
0
        public override string ToString()
        {
            var combination = "";

            if (Key1 != VirtualKeyModifier.None)
            {
                combination = Key1.GetDescription();
            }

            if (Key2 != VirtualKeyModifier.None)
            {
                combination += string.IsNullOrEmpty(combination) ? Key2.GetDescription() : "+" + Key2.GetDescription();
            }

            if (Key3 != VirtualKey.None)
            {
                combination += string.IsNullOrEmpty(combination) ? Key3.GetDescription() : "+" + Key3.GetDescription();
            }
            else
            {
                combination = "";
            }

            return(combination);
        }
Example #6
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node   = new YAMLMappingNode();
            GradientLayout  layout = container.ExportLayout.Serialized.Gradient;

            node.AddSerializedVersion(layout.Version);
            if (layout.Version == 1)
            {
                node.Add(layout.Key0Name, Key0_32.ExportYAML(container));
                node.Add(layout.Key1Name, Key1_32.ExportYAML(container));
                node.Add(layout.Key2Name, Key2_32.ExportYAML(container));
                node.Add(layout.Key3Name, Key3_32.ExportYAML(container));
                node.Add(layout.Key4Name, Key4_32.ExportYAML(container));
                node.Add(layout.Key5Name, Key5_32.ExportYAML(container));
                node.Add(layout.Key6Name, Key6_32.ExportYAML(container));
                node.Add(layout.Key7Name, Key7_32.ExportYAML(container));
            }
            else
            {
                node.Add(layout.Key0Name, Key0.ExportYAML(container));
                node.Add(layout.Key1Name, Key1.ExportYAML(container));
                node.Add(layout.Key2Name, Key2.ExportYAML(container));
                node.Add(layout.Key3Name, Key3.ExportYAML(container));
                node.Add(layout.Key4Name, Key4.ExportYAML(container));
                node.Add(layout.Key5Name, Key5.ExportYAML(container));
                node.Add(layout.Key6Name, Key6.ExportYAML(container));
                node.Add(layout.Key7Name, Key7.ExportYAML(container));
            }

            node.Add(layout.Ctime0Name, Ctime0);
            node.Add(layout.Ctime1Name, Ctime1);
            node.Add(layout.Ctime2Name, Ctime2);
            node.Add(layout.Ctime3Name, Ctime3);
            node.Add(layout.Ctime4Name, Ctime4);
            node.Add(layout.Ctime5Name, Ctime5);
            node.Add(layout.Ctime6Name, Ctime6);
            node.Add(layout.Ctime7Name, Ctime7);
            node.Add(layout.Atime0Name, Atime0);
            node.Add(layout.Atime1Name, Atime1);
            node.Add(layout.Atime2Name, Atime2);
            node.Add(layout.Atime3Name, Atime3);
            node.Add(layout.Atime4Name, Atime4);
            node.Add(layout.Atime5Name, Atime5);
            node.Add(layout.Atime6Name, Atime6);
            node.Add(layout.Atime7Name, Atime7);
            if (layout.HasMode)
            {
                node.Add(layout.ModeName, (int)Mode);
            }

            node.Add(layout.NumColorKeysName, NumColorKeys);
            node.Add(layout.NumAlphaKeysName, NumAlphaKeys);
            return(node);
        }
Example #7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Debug.Log("Warning: multiple " + this + " in scene!");
     }
 }
Example #8
0
        public void Write(AssetWriter writer)
        {
            GradientLayout layout = writer.Layout.Serialized.Gradient;

            if (layout.Version == 1)
            {
                Key0_32.Write(writer);
                Key1_32.Write(writer);
                Key2_32.Write(writer);
                Key3_32.Write(writer);
                Key4_32.Write(writer);
                Key5_32.Write(writer);
                Key6_32.Write(writer);
                Key7_32.Write(writer);
            }
            else
            {
                Key0.Write(writer);
                Key1.Write(writer);
                Key2.Write(writer);
                Key3.Write(writer);
                Key4.Write(writer);
                Key5.Write(writer);
                Key6.Write(writer);
                Key7.Write(writer);
            }

            writer.Write(Ctime0);
            writer.Write(Ctime1);
            writer.Write(Ctime2);
            writer.Write(Ctime3);
            writer.Write(Ctime4);
            writer.Write(Ctime5);
            writer.Write(Ctime6);
            writer.Write(Ctime7);
            writer.Write(Atime0);
            writer.Write(Atime1);
            writer.Write(Atime2);
            writer.Write(Atime3);
            writer.Write(Atime4);
            writer.Write(Atime5);
            writer.Write(Atime6);
            writer.Write(Atime7);
            if (layout.HasMode)
            {
                writer.Write((int)Mode);
            }

            writer.Write(NumColorKeys);
            writer.Write(NumAlphaKeys);
            writer.AlignStream();
        }
Example #9
0
        public void Read(AssetReader reader)
        {
            GradientLayout layout = reader.Layout.Serialized.Gradient;

            if (layout.Version == 1)
            {
                Key0_32 = reader.ReadAsset <ColorRGBA32>();
                Key1_32 = reader.ReadAsset <ColorRGBA32>();
                Key2_32 = reader.ReadAsset <ColorRGBA32>();
                Key3_32 = reader.ReadAsset <ColorRGBA32>();
                Key4_32 = reader.ReadAsset <ColorRGBA32>();
                Key5_32 = reader.ReadAsset <ColorRGBA32>();
                Key6_32 = reader.ReadAsset <ColorRGBA32>();
                Key7_32 = reader.ReadAsset <ColorRGBA32>();
            }
            else
            {
                Key0.Read(reader);
                Key1.Read(reader);
                Key2.Read(reader);
                Key3.Read(reader);
                Key4.Read(reader);
                Key5.Read(reader);
                Key6.Read(reader);
                Key7.Read(reader);
            }

            Ctime0 = reader.ReadUInt16();
            Ctime1 = reader.ReadUInt16();
            Ctime2 = reader.ReadUInt16();
            Ctime3 = reader.ReadUInt16();
            Ctime4 = reader.ReadUInt16();
            Ctime5 = reader.ReadUInt16();
            Ctime6 = reader.ReadUInt16();
            Ctime7 = reader.ReadUInt16();
            Atime0 = reader.ReadUInt16();
            Atime1 = reader.ReadUInt16();
            Atime2 = reader.ReadUInt16();
            Atime3 = reader.ReadUInt16();
            Atime4 = reader.ReadUInt16();
            Atime5 = reader.ReadUInt16();
            Atime6 = reader.ReadUInt16();
            Atime7 = reader.ReadUInt16();
            if (layout.HasMode)
            {
                Mode = (GradientMode)reader.ReadInt32();
            }

            NumColorKeys = reader.ReadByte();
            NumAlphaKeys = reader.ReadByte();
            reader.AlignStream();
        }
Example #10
0
        public YAMLNode ExportYAML(IExportContainer container)
        {
            YAMLMappingNode node = new YAMLMappingNode();

            node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion));
            if (IsColor32(container.ExportVersion))
            {
                node.Add(Key0Name, ((ColorRGBA32)Key0).ExportYAML(container));
                node.Add(Key1Name, ((ColorRGBA32)Key1).ExportYAML(container));
                node.Add(Key2Name, ((ColorRGBA32)Key2).ExportYAML(container));
                node.Add(Key3Name, ((ColorRGBA32)Key3).ExportYAML(container));
                node.Add(Key4Name, ((ColorRGBA32)Key4).ExportYAML(container));
                node.Add(Key5Name, ((ColorRGBA32)Key5).ExportYAML(container));
                node.Add(Key6Name, ((ColorRGBA32)Key6).ExportYAML(container));
                node.Add(Key7Name, ((ColorRGBA32)Key7).ExportYAML(container));
            }
            else
            {
                node.Add(Key0Name, Key0.ExportYAML(container));
                node.Add(Key1Name, Key1.ExportYAML(container));
                node.Add(Key2Name, Key2.ExportYAML(container));
                node.Add(Key3Name, Key3.ExportYAML(container));
                node.Add(Key4Name, Key4.ExportYAML(container));
                node.Add(Key5Name, Key5.ExportYAML(container));
                node.Add(Key6Name, Key6.ExportYAML(container));
                node.Add(Key7Name, Key7.ExportYAML(container));
            }
            node.Add(Ctime0Name, Ctime0);
            node.Add(Ctime1Name, Ctime1);
            node.Add(Ctime2Name, Ctime2);
            node.Add(Ctime3Name, Ctime3);
            node.Add(Ctime4Name, Ctime4);
            node.Add(Ctime5Name, Ctime5);
            node.Add(Ctime6Name, Ctime6);
            node.Add(Ctime7Name, Ctime7);
            node.Add(Atime0Name, Atime0);
            node.Add(Atime1Name, Atime1);
            node.Add(Atime2Name, Atime2);
            node.Add(Atime3Name, Atime3);
            node.Add(Atime4Name, Atime4);
            node.Add(Atime5Name, Atime5);
            node.Add(Atime6Name, Atime6);
            node.Add(Atime7Name, Atime7);
            if (HasMode(container.ExportVersion))
            {
                node.Add(ModeName, (int)Mode);
            }

            node.Add(NumColorKeysName, NumColorKeys);
            node.Add(NumAlphaKeysName, NumAlphaKeys);
            return(node);
        }
Example #11
0
 public List <Value> this[Key1 keyOne, Key2 keyTwo]
 {
     get
     {
         List <Value> val;
         Key3         key = new Key3(keyOne, keyTwo);
         if (dictThree.TryGetValue(key, out val))
         {
             return(val);
         }
         return(null);
     }
 }
Example #12
0
        public void Write(AssetWriter writer)
        {
            if (IsColor32(writer.Version))
            {
                Key0.Write32(writer);
                Key1.Write32(writer);
                Key2.Write32(writer);
                Key3.Write32(writer);
                Key4.Write32(writer);
                Key5.Write32(writer);
                Key6.Write32(writer);
                Key7.Write32(writer);
            }
            else
            {
                Key0.Write(writer);
                Key1.Write(writer);
                Key2.Write(writer);
                Key3.Write(writer);
                Key4.Write(writer);
                Key5.Write(writer);
                Key6.Write(writer);
                Key7.Write(writer);
            }

            writer.Write(Ctime0);
            writer.Write(Ctime1);
            writer.Write(Ctime2);
            writer.Write(Ctime3);
            writer.Write(Ctime4);
            writer.Write(Ctime5);
            writer.Write(Ctime6);
            writer.Write(Ctime7);
            writer.Write(Atime0);
            writer.Write(Atime1);
            writer.Write(Atime2);
            writer.Write(Atime3);
            writer.Write(Atime4);
            writer.Write(Atime5);
            writer.Write(Atime6);
            writer.Write(Atime7);
            if (HasMode(writer.Version))
            {
                writer.Write((int)Mode);
            }

            writer.Write(NumColorKeys);
            writer.Write(NumAlphaKeys);
            writer.AlignStream();
        }
Example #13
0
        public void Read(AssetReader reader)
        {
            if (IsColor32(reader.Version))
            {
                Key0.Read32(reader);
                Key1.Read32(reader);
                Key2.Read32(reader);
                Key3.Read32(reader);
                Key4.Read32(reader);
                Key5.Read32(reader);
                Key6.Read32(reader);
                Key7.Read32(reader);
            }
            else
            {
                Key0.Read(reader);
                Key1.Read(reader);
                Key2.Read(reader);
                Key3.Read(reader);
                Key4.Read(reader);
                Key5.Read(reader);
                Key6.Read(reader);
                Key7.Read(reader);
            }

            Ctime0 = reader.ReadUInt16();
            Ctime1 = reader.ReadUInt16();
            Ctime2 = reader.ReadUInt16();
            Ctime3 = reader.ReadUInt16();
            Ctime4 = reader.ReadUInt16();
            Ctime5 = reader.ReadUInt16();
            Ctime6 = reader.ReadUInt16();
            Ctime7 = reader.ReadUInt16();
            Atime0 = reader.ReadUInt16();
            Atime1 = reader.ReadUInt16();
            Atime2 = reader.ReadUInt16();
            Atime3 = reader.ReadUInt16();
            Atime4 = reader.ReadUInt16();
            Atime5 = reader.ReadUInt16();
            Atime6 = reader.ReadUInt16();
            Atime7 = reader.ReadUInt16();
            if (HasMode(reader.Version))
            {
                Mode = (GradientMode)reader.ReadInt32();
            }

            NumColorKeys = reader.ReadByte();
            NumAlphaKeys = reader.ReadByte();
            reader.AlignStream();
        }
Example #14
0
        GameObject NewGO(string name, Key3 k, int i, int idx)
        {
            var go = new GameObject(name);
            var t  = go.transform;

            t.gameObject.layer = layerKeyNum;
            t.SetParent(keysContainer);
            t.position = i == 0 ? k.vector : i == 1 ? k.inTangent : k.outTangent;

            var ce = go.AddComponent <ColliderEvents>();

            ce.boxSize      = keyClickSize;
            ce.onRaycastHit = () => { ClickKey(k, i, idx); };
            if (i == 0)
            {
                ce.onUpdate = () => { ce.transform.position = k.vector; }
            }
            ;
            else if (i == 1)
            {
                ce.onUpdate = () => { ce.transform.position = k.inTangent; }
            }
            ;
            else
            {
                ce.onUpdate = () => { ce.transform.position = k.outTangent; }
            };
            return(go);
        }

        void ClickKey(Key3 k, int i, int idx)
        {
            this.idx    = idx;
            keySelected = k;
            idxSelected = i;
            if (i == 0)
            {
                GizmosAxis.I.transform.position = k.vector;
            }
            else if (i == 1)
            {
                GizmosAxis.I.transform.position = k.inTangent;
            }
            else if (i == 2)
            {
                GizmosAxis.I.transform.position = k.outTangent;
            }
        }
    }
Example #15
0
 public void Read(AssetStream stream)
 {
     if (IsColor32(stream.Version))
     {
         Key32_0.Read(stream);
         Key32_1.Read(stream);
         Key32_2.Read(stream);
         Key32_3.Read(stream);
         Key32_4.Read(stream);
         Key32_5.Read(stream);
         Key32_6.Read(stream);
         Key32_7.Read(stream);
     }
     else
     {
         Key0.Read(stream);
         Key1.Read(stream);
         Key2.Read(stream);
         Key3.Read(stream);
         Key4.Read(stream);
         Key5.Read(stream);
         Key6.Read(stream);
         Key7.Read(stream);
     }
     Ctime0 = stream.ReadUInt16();
     Ctime1 = stream.ReadUInt16();
     Ctime2 = stream.ReadUInt16();
     Ctime3 = stream.ReadUInt16();
     Ctime4 = stream.ReadUInt16();
     Ctime5 = stream.ReadUInt16();
     Ctime6 = stream.ReadUInt16();
     Ctime7 = stream.ReadUInt16();
     Atime0 = stream.ReadUInt16();
     Atime1 = stream.ReadUInt16();
     Atime2 = stream.ReadUInt16();
     Atime3 = stream.ReadUInt16();
     Atime4 = stream.ReadUInt16();
     Atime5 = stream.ReadUInt16();
     Atime6 = stream.ReadUInt16();
     Atime7 = stream.ReadUInt16();
     if (IsReadMode(stream.Version))
     {
         Mode = stream.ReadInt32();
     }
     NumColorKeys = stream.ReadByte();
     NumAlphaKeys = stream.ReadByte();
     stream.AlignStream(AlignType.Align4);
 }
Example #16
0
 /// <summary>
 /// オブジェクトのハッシュ値を計算します。
 /// </summary>
 /// <returns>
 /// 計算されたハッシュ値です。
 /// </returns>
 public override int GetHashCode()
 {
     return(Key1.GetHashCode() ^ Key2.GetHashCode() ^ Key3.GetHashCode() ^ Key4.GetHashCode() ^ Key5.GetHashCode() ^ Key6.GetHashCode() ^ Key7.GetHashCode());
 }