Exemple #1
0
        public static void SendRPCToPlayer(PhotonPlayer player)
        {
            Hashtable hash          = new Hashtable();
            string    vanillaString = string.Empty;
            string    anarchyString = string.Empty;
            int       count         = 0;

            for (int i = 0; i < allGameSettings.Count; i++)
            {
                GameModeSetting set = allGameSettings[i];
                if (set.Enabled)
                {
                    set.WriteToHashtable(hash);
                    count++;
                    if (!player.AnarchySync && set is AnarchyGameModeSetting setting)
                    {
                        if (anarchyString.Length > 0)
                        {
                            anarchyString += "\n";
                        }
                        anarchyString += setting.ToString();
                    }
                    else if (!player.RCSync)
                    {
                        if (vanillaString.Length > 0)
                        {
                            vanillaString += "\n";
                        }
                        vanillaString += set.ToString();
                    }
                }
            }
            if (count <= 0)
            {
                if (MOTD.Value.Length > 0)
                {
                    FengGameManagerMKII.FGM.BasePV.RPC("Chat", player, new object[] { "MOTD: " + MOTD.Value, string.Empty });
                }
                return;
            }
            FengGameManagerMKII.FGM.BasePV.RPC("settingRPC", player, new object[] { hash });
            if (!player.RCSync & vanillaString.Length > 0)
            {
                FengGameManagerMKII.FGM.BasePV.RPC("Chat", player, new object[] { vanillaString, string.Empty });
            }
            if (!player.AnarchySync && anarchyString.Length > 0)
            {
                FengGameManagerMKII.FGM.BasePV.RPC("Chat", player, new object[] { anarchyString, string.Empty });
            }
            if (MOTD.Value != string.Empty)
            {
                FengGameManagerMKII.FGM.BasePV.RPC("Chat", player, new object[] { "MOTD: " + MOTD.Value, string.Empty });
            }
        }
 public static void AnarchySettingCallback(GameModeSetting set, bool state, bool received)
 {
     if (PhotonNetwork.IsMasterClient && !received)
     {
         PhotonPlayer[] targets = PhotonPlayer.GetNotAnarchyUsers();
         if (targets.Length <= 0)
         {
             return;
         }
         FengGameManagerMKII.FGM.BasePV.RPC("Chat", targets, new object[] { set.ToString(), string.Empty });
     }
 }