コード例 #1
0
        private void CheckChecksum(int clientChecksum)
        {
            LogicJSONObject debugJSON = new LogicJSONObject();
            ChecksumHelper  checksum  = this.m_logicGameMode.CalculateChecksum(debugJSON, EnvironmentSettings.Settings.ContentValidationModeEnabled);

            if (checksum.GetChecksum() != clientChecksum)
            {
                OutOfSyncMessage outOfSyncMessage = new OutOfSyncMessage();

                outOfSyncMessage.SetSubTick(this.m_logicGameMode.GetLevel().GetLogicTime().GetTick());
                outOfSyncMessage.SetClientChecksum(clientChecksum);
                outOfSyncMessage.SetServerChecksum(checksum.GetChecksum());
                outOfSyncMessage.SetDebugJSON(debugJSON);

                this.m_session.SendPiranhaMessage(outOfSyncMessage, 1);
                this.m_shouldDestruct = true;
            }
        }
コード例 #2
0
        public ChecksumHelper CalculateChecksum(LogicJSONObject root, bool includeGameObjects)
        {
            ChecksumHelper checksum = new ChecksumHelper(root);

            checksum.StartObject("LogicGameMode");

            checksum.WriteValue("subtick", this.m_level.GetLogicTime().GetTick());
            checksum.WriteValue("m_currentTimestamp", this.m_startTimestamp);

            if (this.m_level.GetHomeOwnerAvatar() != null)
            {
                checksum.StartObject("homeOwner");
                this.m_level.GetHomeOwnerAvatar().GetChecksum(checksum);
                checksum.EndObject();
            }

            if (this.m_level.GetVisitorAvatar() != null)
            {
                checksum.StartObject("visitor");
                this.m_level.GetVisitorAvatar().GetChecksum(checksum);
                checksum.EndObject();
            }

            this.m_level.GetGameObjectManager().GetChecksum(checksum, includeGameObjects);

            if (this.m_calendar != null)
            {
                checksum.StartObject("calendar");
                this.m_calendar.GetChecksum(checksum);
                checksum.EndObject();
            }

            checksum.WriteValue("checksum", checksum.GetChecksum());
            checksum.EndObject();

            return(checksum);
        }