Beispiel #1
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);
        }
Beispiel #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((Key1.GetHashCode() * 397) ^ Key2.GetHashCode());
     }
 }
Beispiel #3
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>
        /// このオブジェクトがoより大きいならば正の値、oと等しいならば0、oより小さいならば負の値を返します。
        /// </returns>
        public int CompareTo(ComparableCompositeKey <KEY1_T, KEY2_T, KEY3_T, KEY4_T, KEY5_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);
            }
            if ((c = Key4.CompareTo(o.Key4)) != 0)
            {
                return(c);
            }
            if ((c = Key5.CompareTo(o.Key5)) != 0)
            {
                return(c);
            }
            return(0);
        }
Beispiel #5
0
 /// <summary>
 /// オブジェクトが等しいかどうか調べます。
 /// </summary>
 /// <param name="o">
 /// 比較対象のオブジェクトです。
 /// </param>
 /// <returns>
 /// オブジェクトが等しければtrue、そうではないのならfalseです。
 /// </returns>
 public bool Equals(CompositeKey <KEY1_T, KEY2_T, KEY3_T, KEY4_T, KEY5_T, KEY6_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);
     }
     if (!Key6.Equals(o.Key6))
     {
         return(false);
     }
     return(true);
 }
Beispiel #6
0
    // Update is called once per frame
    private void FixedUpdate()
    {
        if (witch.id == 0 ?
            (Input.GetKeyDown(KeyCode.Joystick1Button1) || Input.GetKeyDown(KeyCode.Joystick1Button2)) :
            (Input.GetKeyDown(KeyCode.Joystick2Button1) || Input.GetKeyDown(KeyCode.Joystick2Button2)))
        {
            if (word > 0 && witch.state == Witch.NORMAL)
            {
                Debug.Log(word);
                witch.chant(word);
                word = 0;
                if (Key0.GetComponent <Key>().isChanted)
                {
                    Key0.GetComponent <Key>().refresh();
                }
                if (Key1.GetComponent <Key>().isChanted)
                {
                    Key1.GetComponent <Key>().refresh();
                }
                if (Key2.GetComponent <Key>().isChanted)
                {
                    Key2.GetComponent <Key>().refresh();
                }
                weight     = 100;
                isChanting = false;
            }
        }
        else
        {
            xInput = witch.id == 0 ? -Input.GetAxis("Horizontal 1") : -Input.GetAxis("Horizontal 2");
            yInput = witch.id == 0 ? -Input.GetAxis("Vertical 1") : -Input.GetAxis("Vertical 2");
            Debug.Log(xInput.ToString() + "," + yInput.ToString());
            key = (yInput > 0.1f && xInput == 0) ? Key0.GetComponent <Key>() :
                  (yInput < 0.1f && xInput < -0.1f) ? Key1.GetComponent <Key>() :
                  (yInput <0.1f && xInput> 0.1f) ? Key2.GetComponent <Key>() : null;

            if (key != null && !key.isChanted)
            {
                if (!key.isFrozen && !isChanting)
                {
                    isChanting = true;
                    // witch.state = Witch.CHANGTING;
                    key.isChanted = true;
                    word         += weight * key.color;
                    weight       /= 10;
                    key.GetComponent <SpriteRenderer>().sprite = Sprites.getKey1(key.color);
                    key.transform.localScale = new Vector2(0.8f, 0.8f);
                }
                else if (!key.isFrozen && isChanting)
                {
                    key.isChanted = true;
                    word         += weight * key.color;
                    weight       /= 10;
                    key.GetComponent <SpriteRenderer>().sprite = Sprites.getKey1(key.color);
                    key.transform.localScale = new Vector2(0.8f, 0.8f);
                }
            }
        }
    }
Beispiel #7
0
            public override bool Equals(object obj)
            {
                if (obj is CompoundKey compositeKey)
                {
                    return(Key1.Equals(compositeKey.Key1) && Key2.Equals(compositeKey.Key2) && Key3.Equals(compositeKey.Key3));
                }

                return(false);
            }
Beispiel #8
0
        public override int GetHashCode()
        {
            var hashCode = -2131266610;

            hashCode = hashCode * -1521134295 + Key1.GetHashCode();
            hashCode = hashCode * -1521134295 + Key2.GetHashCode();
            hashCode = hashCode * -1521134295 + Key3.GetHashCode();
            return(hashCode);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Key1.GetHashCode();
         result = (result * 397) ^ Key2.GetHashCode();
         result = (result * 397) ^ Value.GetHashCode();
         return(result);
     }
 }
Beispiel #10
0
        public Standing(Entity.User user, Entity.Contest contest)
        {
            UserID  = user.ID;
            Details = new List <StandingCol>();
            var problems = contest.Problems.OrderBy(x => x.Credit);

            foreach (var problem in problems)
            {
                Details.Add(new StandingCol(user, problem));
            }
            Key1     = Details.Sum(x => x.Key1);
            Key2     = Details.Sum(x => x.Key2);
            Key3     = Details.Sum(x => x.Key3);
            Gravatar = Helpers.Gravatar.GetAvatarURL(user.Gravatar, 180);
            Nickname = Helpers.ColorName.GetNicknameHtml(user.Nickname, user.Ratings.Sum(x => x.Credit) + 1500);
            UserID   = user.ID;
            Display1 = Key1.ToString();
            switch (contest.Format)
            {
            case Entity.ContestFormat.OI:
                Display2 = Key2 + " ms";
                break;

            case Entity.ContestFormat.OPJOI:
                Display2 = Key2.ToString();
                break;

            case Entity.ContestFormat.ACM:
                Display2 = new TimeSpan(0, 0, Key2).ToString("c");
                break;

            case Entity.ContestFormat.Codeforces:
            case Entity.ContestFormat.TopCoder:
                if (Key2 == 0 && Key3 == 0)
                {
                    Display2 = "";
                }
                else if (Key2 != 0 && Key3 == 0)
                {
                    Display2 = "+" + Key2;
                }
                else if (Key2 == 0 && Key3 != 0)
                {
                    Display2 = "-" + Key3;
                }
                else
                {
                    Display2 = "+" + Key2 + " : -" + Key3;
                }
                Key1    += Key2 * 100;
                Key1    -= Key3 * 50;
                Display1 = Key1.ToString();
                break;
            }
        }
Beispiel #11
0
 public void PrefixWithFindPrevKeyWorks()
 {
     using var fileCollection = new InMemoryFileCollection();
     using var db             = NewKeyValueDB(fileCollection);
     using var tr             = db.StartTransaction();
     tr.CreateKey(_key1);
     tr.CreateKey(Key2);
     Assert.True(tr.FindFirstKey(Key2.AsSpan(0, 1)));
     Assert.False(tr.FindPreviousKey(Key2.AsSpan(0, 1)));
     tr.Commit();
 }
Beispiel #12
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);
        }
Beispiel #13
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Debug.Log("Warning: multiple " + this + " in scene!");
     }
 }
Beispiel #14
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();
        }
Beispiel #15
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();
        }
Beispiel #16
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);
        }
Beispiel #17
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Key1 != null ? Key1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Key2 != null ? Key2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasShiftModifier.GetHashCode();
         hashCode = (hashCode * 397) ^ HasCtrlModifier.GetHashCode();
         hashCode = (hashCode * 397) ^ HasAltModifier.GetHashCode();
         hashCode = (hashCode * 397) ^ IsEnabled.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #18
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();
        }
Beispiel #19
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();
        }
Beispiel #20
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);
 }
Beispiel #21
0
            /// <summary>
            /// 等待数据初始化完成
            /// </summary>
            public static void WaitSqlLoaded()
            {
                if (!isSqlLoaded)
                {
                    sqlTable /**/.WaitLoad();
                    isSqlLoaded = true;
                }
            }
        }
    }
} namespace AutoCSer.Example.OrmModel
{
    public partial class ComparablePrimaryKey
    {
        /// <summary>
        /// 关键字
        /// </summary>
        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)]
        public struct DataPrimaryKey : IEquatable <DataPrimaryKey>, IComparable <DataPrimaryKey>
        {
            /// <summary>
            /// 关键字 1
            /// </summary>
            public int Key1;
            /// <summary>
            /// 关键字 2
            /// </summary>
            public int Key2;
            /// <summary>
            /// 关键字比较
            /// </summary>
            /// <param name="other">关键字</param>
            /// <returns>是否相等</returns>
            public bool Equals(DataPrimaryKey other)
            {
                return(Key1 /**/.Equals(other.Key1) && Key2 /**/.Equals(other.Key2));
            }

            /// <summary>
            /// 哈希编码
            /// </summary>
            /// <returns></returns>
            public override int GetHashCode()
            {
                return(Key1.GetHashCode() ^ Key2 /**/.GetHashCode());
            }
Beispiel #22
0
        internal bool UnregisterSubscription(IPEndPoint RemoteEndpoint, ulong Token)
        {
            string Prefix = RemoteEndpoint.ToString() + " ";
            string Key    = Prefix + Token.ToString();

            lock (this.registrations)
            {
                this.registeredMessages = null;
                if (this.registrations.Remove(Key))
                {
                    return(true);
                }

                if (Token == 0)
                {
                    LinkedList <string> ToRemove = null;

                    foreach (string Key2 in this.registrations.Keys)
                    {
                        if (Key2.StartsWith(Prefix))
                        {
                            if (ToRemove is null)
                            {
                                ToRemove = new LinkedList <string>();
                            }

                            ToRemove.AddLast(Key2);
                        }
                    }

                    if (ToRemove != null)
                    {
                        foreach (string Key2 in ToRemove)
                        {
                            this.registrations.Remove(Key2);
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
        public override string ToString()
        {
            var s = new System.Text.StringBuilder("");

            s.Append('[');
            if (Key1 != null)
            {
                s.Append(Key1.ToString());
            }
            s.Append(", ");
            if (Key2 != null)
            {
                s.Append(Key2.ToString());
            }
            s.Append(", ");
            if (Value != null)
            {
                s.Append(Value.ToString());
            }
            s.Append(']');
            return(s.ToString());
        }
 /// <summary>
 /// オブジェクトのハッシュ値を計算します。
 /// </summary>
 /// <returns>
 /// 計算されたハッシュ値です。
 /// </returns>
 public override int GetHashCode()
 {
     return(Key1.GetHashCode() ^ Key2.GetHashCode());
 }
 public override string ToString()
 {
     return(Key1.ToString() + " - " + Key2.ToString() + " - " + Value.ToString());
 }
 public bool Equals(ComplexKey other)
 {
     return(Key1.Equals(other.Key1) && Key2.Equals(other.Key2));
 }
Beispiel #27
0
 public Key3(Key1 key1, Key2 key2)
 {
     firstKey  = key1;
     secondKey = key2;
 }
Beispiel #28
0
 /// <summary>
 /// オブジェクトのハッシュ値を計算します。
 /// </summary>
 /// <returns>
 /// 計算されたハッシュ値です。
 /// </returns>
 public override int GetHashCode()
 {
     return(Key1.GetHashCode() ^ Key2.GetHashCode() ^ Key3.GetHashCode() ^ Key4.GetHashCode() ^ Key5.GetHashCode() ^ Key6.GetHashCode() ^ Key7.GetHashCode());
 }
Beispiel #29
0
        private void Update()
        {
            this.BeginOrtho();

            Curve2.colorCtrlLines = clrCtrlLinesUnSel;
            Curve2.colorBorder    = clrBorder;

            var offset = m_Ref_Curve.ScaleV2(-drawAreaOffset);

            drawAreaStart = offset.RoundToInt();
            drawAreaEnd   = drawAreaStart + drawAreaSize_I;
            // TODO GridLine 对应 Offset调整
            // TODO Offset 绘制Curve

            var lineSpaceFst = (drawAreaSize * gridFactor).RoundToInt();

            lineSpaceFst = Vector2Int.Max(Vector2Int.one * 2, lineSpaceFst);
            var lineSpaceSnd = (lineSpaceFst * Vectors.half2d).RoundToInt();

            // grids
            var a = drawAreaStart;
            var b = new Vector2(drawAreaEnd.x, drawAreaStart.y);

            for (int i = drawAreaStart.y; i <= drawAreaEnd.y; b.y = a.y = i += 1)
            {
                if (i % lineSpaceSnd.y == 0)
                {
                    DrawLine(a, b, (i % lineSpaceFst.y == 0) ? clrGridLinesFst : clrGridLinesSnd, m_Curve_Ref);
                }
            }
            a = drawAreaStart;
            b = new Vector2(drawAreaStart.x, drawAreaEnd.y);
            for (int i = drawAreaStart.x; i <= drawAreaEnd.x; b.x = a.x = i += 1)
            {
                if (i % lineSpaceSnd.x == 0)
                {
                    DrawLine(a, b, (i % lineSpaceFst.x == 0) ? clrGridLinesFst : clrGridLinesSnd, m_Curve_Ref);
                }
            }
            // Timeline 当前帧
            GLUI.BeginOrder(5);
            b.x = a.x = UITimeLine.I.frameIdx;
            DrawLine(a, b, UITimeLine.I.clrTimeLine, m_Curve_Ref);

            // Axis 坐标轴
            GLUI.BeginOrder(2);
            b.x = a.x = 0;
            a.y = drawAreaStart.y;
            b.y = drawAreaEnd.y;
            DrawLine(a, b, UITimeLine.I.clrAxis, m_Curve_Ref);

            b.y = a.y = 0;
            a.x = drawAreaStart.x;
            b.x = drawAreaEnd.x;
            DrawLine(a, b, UITimeLine.I.clrAxis, m_Curve_Ref);

            if (curveObj == null)
            {
                return;
            }
            var cc = 0;

            // Curve
            foreach (var curve in curveObj.curves)
            {
                if (drawSelOnly)
                {
                    Curve2.colorTrack = clrTracks[(int)_curveSelType];
                }
                else
                {
                    Curve2.colorTrack = clrTracks[cc++];
                }
                if (drawSelOnly && curve != curveSel)
                {
                    continue;
                }
                if (curve == null || curve.Count == 0)
                {
                    continue;
                }
                if (mirror) // 使用默认方法画出曲线线段
                {
                    curveMirror.drawAreaSize   = drawAreaSize;
                    curveMirror.drawAreaOffset = offset;
                    curveMirror.Draw(m_Curve_Ref, showTangentsUnSel);
                }
                else
                {
                    curve.drawAreaSize   = drawAreaSize;
                    curve.drawAreaOffset = offset;
                    curve.Draw(m_Curve_Ref, showTangentsUnSel);
                }

                // 尾线
                GLUI.BeginOrder(3);
                var l = curve.Last().frameKey;
                var e = new Vector2(drawAreaSize.x, l.y);
                DrawLine(l, e, Curve2.colorTrack, m_Curve_Ref);
            }
            GLUI.BeginOrder(4);
            Key2 k = keySel;

            if (drawSel && k != null)
            {
                var i = (subIdxs != null && id < subIdxs.Count) ? subIdxs[id] : -1;


                if (k.inMode == KeyMode.Bezier)
                {
                    DrawLine(k.frameKey, k.inKey, i == 0 || i == 1 ? clrSubSel : clrCtrlLinesSel, m_Curve_Ref);
                    //DrawTangent(k.inTangent, Curve2.colorTangents, matrixViewToRect);
                }
                if (k.outMode == KeyMode.Bezier && !(mirror && k.time == 0.5f))
                {
                    DrawLine(k.frameKey, k.outKey, i == 0 || i == 2 ? clrSubSel : clrCtrlLinesSel, m_Curve_Ref);
                    //DrawTangent(k.outTangent, Curve2.colorTangents, matrixViewToRect);
                }

                DrawRect(k.frameKey, Vector2.one * sizeDrawVector,
                         Curve2.colorVectors, m_Curve_Ref, i == 0 ? clrSubSel : clrVectorSel, true);
                if (k.inMode == KeyMode.Bezier)
                {
                    DrawRhombus(k.inKey, Vector2.one * sizeDrawTangent,
                                Curve2.colorTangents, m_Curve_Ref, i == 0 || i == 1 ? clrSubSel : clrCtrlLinesSel, true);
                }
                if (k.outMode == KeyMode.Bezier && !(mirror && k.time == 0.5f))
                {
                    DrawRhombus(k.outKey, Vector2.one * sizeDrawTangent,
                                Curve2.colorTangents, m_Curve_Ref, i == 0 || i == 2 ? clrSubSel : clrCtrlLinesSel, true);
                }
            }
        }
Beispiel #30
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!gameMenuOn)
            {
                gameMenu.SetActive(true);
                Cursor.lockState = CursorLockMode.None;
                Cursor.visible   = true;
                gameMenuOn       = true;
            }
            else
            {
                gameMenu.SetActive(false);
                Cursor.lockState = CursorLockMode.Locked;
                Cursor.visible   = false;
                gameMenuOn       = false;
            }
        }


        if (player.Health <= 0f)
        {
            player.playerDied();
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;

            Ray        ray = fpsCamera.GetComponent <Camera>().ScreenPointToRay(new Vector3(x, y));
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                Key1 objectKey = hit.collider.GetComponent <Key1>();
                if (objectKey != null)
                {
                    player.SetKey1Active();
                    beep.Play(0);
                }
                Key2 objectKey2 = hit.collider.GetComponent <Key2>();
                if (objectKey2 != null)
                {
                    player.SetKey2Active();
                    beep.Play(0);
                }
            }
        }

        counter = 0;
        for (int i = 0; i < enemies.Count; i++)
        {
            float distance = Vector3.Distance(enemies[i].transform.position, player.transform.position);

            if (distance < damageDistance && player.Health >= 0f)
            {
                damageVisual.SetActive(true);
                player.Health -= damage * Time.deltaTime;
                counter++;
            }
            else if (counter == 0) // Sets visual to false if no ghosts near
            {
                damageVisual.SetActive(false);
            }
        }
    }