Beispiel #1
0
        public static void SendRPC()
        {
            StringBuilder bld       = new StringBuilder();
            Hashtable     hash      = new Hashtable();
            int           count     = 0;
            int           countSend = 0;

            for (int i = 0; i < allGameSettings.Count; i++)
            {
                GameModeSetting set = allGameSettings[i];
                if (set.Enabled && !set.HasChanged)
                {
                    set.WriteToHashtable(hash);
                    count++;
                    continue;
                }
                if (set.HasChanged)
                {
                    bool oldstate = set.State;
                    set.Apply();
                    if (oldstate != set.State && set.State == false)
                    {
                        set.Save();
                        continue;
                    }
                    set.WriteToHashtable(hash);
                    if (countSend > 0)
                    {
                        bld.Append("\n");
                    }
                    bld.Append(set.ToStringLocal());
                    set.Save();
                    count++;
                    countSend++;
                }
            }
            if (count <= 0)
            {
                return;
            }
            if (InfectionMode.Enabled)
            {
                InfectionUpdate();
            }
            if (TeamMode.Enabled)
            {
                SendTeamInfo();
            }
            FengGameManagerMKII.FGM.BasePV.RPC("settingRPC", PhotonTargets.Others, new object[] { hash });
            if (bld.ToString() != string.Empty)
            {
                Chat.Add(bld.ToString());
            }
        }
Beispiel #2
0
        public static void HandleRPC(Hashtable hash)
        {
            if (oldHash.Equals(hash))
            {
                return;
            }
            int           count = 0;
            StringBuilder bld   = new StringBuilder();

            for (int i = 0; i < allGameSettings.Count; i++)
            {
                GameModeSetting set = allGameSettings[i];
                set.ReadFromHashtable(hash);
                if (set.HasChangedReceived)
                {
                    set.ApplyReceived();
                    if (count > 0)
                    {
                        bld.Append("\n");
                    }
                    bld.Append(set.ToStringLocal());
                    count++;
                }
            }
            if (hash.ContainsKey("motd") && oldHash.ContainsKey("motd") && oldHash["motd"] as string != hash["motd"] as string)
            {
                if (count > 0)
                {
                    bld.Append("\n");
                }
                bld.Append("MOTD: " + hash["motd"].ToString());
            }
            oldHash = new Hashtable();
            Dictionary <object, object> clone = (Dictionary <object, object>)hash.Clone();

            foreach (KeyValuePair <object, object> pair in clone)
            {
                oldHash.Add(pair.Key, pair.Value);
            }
            Chat.Add(bld.ToString());
        }