예제 #1
0
        public uint256_tests()
        {
            R1Array    = ToBytes("\x9c\x52\x4a\xdb\xcf\x56\x11\x12\x2b\x29\x12\x5e\x5d\x35\xd2\xd2\x22\x81\xaa\xb5\x33\xf0\x08\x32\xd5\x56\xb1\xf9\xea\xe5\x1d\x7d");
            R1L        = new uint256(R1Array);
            NegR1L     = ~R1L;
            R1S        = new uint160(R1Array.Take(20).ToArray());
            NegR1S     = ~R1S;
            NegR1Array = NegR1L.ToBytes();

            R2Array    = ToBytes("\x70\x32\x1d\x7c\x47\xa5\x6b\x40\x26\x7e\x0a\xc3\xa6\x9c\xb6\xbf\x13\x30\x47\xa3\x19\x2d\xda\x71\x49\x13\x72\xf0\xb4\xca\x81\xd7");
            R2L        = new uint256(R2Array);
            NegR2L     = ~R2L;
            R2S        = new uint160(R2Array.Take(20).ToArray());
            NegR2S     = ~R2S;
            NegR2Array = NegR2L.ToBytes();

            ZeroArray = ToBytes("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");
            ZeroL     = new uint256(ZeroArray);
            ZeroS     = new uint160(ZeroArray.Take(20).ToArray());

            OneArray = ToBytes("\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");
            OneL     = new uint256(OneArray);
            OneS     = new uint160(OneArray.Take(20).ToArray());

            MaxArray = ToBytes("\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff");
            MaxL     = new uint256(MaxArray);
            MaxS     = new uint160(MaxArray.Take(20).ToArray());

            HalfL = OneL << 255;
            HalfS = OneS << 159;
        }
 private void OnServerMetadataReceived(OneArray obj)
 {
     if (++_metadataReceivedCount % 10000 == 0)
     {
         Debug.LogFormat("Received metadata messages: {0}", _metadataReceivedCount);
     }
 }
예제 #3
0
 /// <summary>
 /// CustomCommandReceived event handler.
 /// </summary>
 private static void OnCustomCommandReceived(OneArray data)
 {
     // Extracting keys from the custom command is optional. These are example values sent from the Fake Agent.
     // A real game may or may not have custom key values, as needed.
     using (var obj0 = data.GetObject(0))
         using (var obj1 = data.GetObject(1))
         {
             LogWithTimestamp(string.Format("Received <b>custom command</b> packet:\n" +
                                            "(key : \"{0}\", value : \"{1}\")\n" +
                                            "(key : \"{2}\", value : \"{3}\")\n",
                                            obj0.GetString("key"),
                                            obj0.GetString("value"),
                                            obj1.GetString("key"),
                                            obj1.GetString("value")));
         }
 }
예제 #4
0
        /// <summary>
        /// AllocatedReceived event handler.
        /// </summary>
        private void OnServerAllocatedReceived(OneArray metadata)
        {
            // Extracting keys from the metadata is optional. These are example values sent from the Fake Agent.
            // A real game may or may not have custom key values, as needed.
            using (var obj0 = metadata.GetObject(0))
                using (var obj1 = metadata.GetObject(1))
                {
                    LogWithTimestamp(string.Format("Received <b>Allocated</b> packet with metadata:\n{0} : {1}\n{2} : {3}",
                                                   obj0.GetString("key"),
                                                   obj0.GetString("value"),
                                                   obj1.GetString("key"),
                                                   obj1.GetString("value")));
                }

            // Confirm that the server has acknowledged by sending OneServerAllocated status.
            server.SetApplicationInstanceStatus(OneApplicationInstanceStatus.OneServerAllocated);
        }