コード例 #1
0
 /// <summary>
 /// Gets the currently selected arena character.
 /// </summary>
 /// <param name="setup">The <see cref="ArenaSetup"/> that this selection is associated with.</param>
 /// <returns>A representation of the selected arena character.</returns>
 public static PlayerDescriptor GetSelectedArenaCharacter(ArenaSetup setup)
 {
     if (setup == null)
     {
         return(new PlayerDescriptor(0));
     }
     return(arenaCharacter.TryGet(setup, out PlayerDescriptor ret) ? ret : new PlayerDescriptor(0));
 }
コード例 #2
0
 void Start()
 {
     arenaSetup    = arena.GetComponent <ArenaSetup>();
     scoreManager  = ScoreBoard.GetComponent <ScoreManager>();
     turnIndicator = Instantiate(turnIndicator);
     playerTypes   = PlayerInformation.GetPlayerTypes();
     SetupGame();
     StartGame();
 }
コード例 #3
0
 /* <summary>
  * The function is called when the component is instantiated
  * </summary>
  */
 private void Awake()
 {
     if ((singleton != null) && (singleton != this))
     {
         Destroy(this);
         return;
     }
     singleton = this;
 }
コード例 #4
0
        private void InitializeSitting()
        {
            if (this.manager.arenaSetup == null)
            {
                ArenaSetup setup = new ArenaSetup
                {
                    currentGameType = ArenaSetup.GameTypeID.Sandbox
                };

                setup.gametypeSetups.Add(new ArenaSetup.GameTypeSetup());
                setup.gametypeSetups[setup.gametypeSetups.Count - 1].InitAsGameType(ArenaSetup.GameTypeID.Sandbox);

                this.manager.arenaSetup = setup;
            }

            this.manager.arenaSitting = new ArenaSitting(this.GetGameTypeSetup, this.multiplayerUnlocks)
            {
                levelPlaylist = new List <string>()
            };
            this.manager.arenaSitting.levelPlaylist.Add("SoundTest");
        }
コード例 #5
0
 private static void ArenaSetup_LoadFromFile(On.ArenaSetup.orig_LoadFromFile orig, ArenaSetup self)
 {
     orig(self);
     try
     {
         arenaCharacter[self] = PlayerDescriptor.FromString(File.ReadAllText(arenaSettingsPath));
     } catch (Exception e)
     {
         Debug.LogException(new FormatException("Invalid arena settings format. This error is not fatal.", e));
         arenaCharacter.Unset(self);
     }
 }
コード例 #6
0
 private static void ArenaSetup_SaveToFile(On.ArenaSetup.orig_SaveToFile orig, ArenaSetup self)
 {
     orig(self);
     if (arenaCharacter.TryGet(self, out var ply))
     {
         File.WriteAllText(arenaSettingsPath, ply.ToString());
     }
     else
     {
         File.Delete(arenaSettingsPath);
     }
 }
コード例 #7
0
 private void Awake()
 {
     MakeSingleton();
     arenaSetup = arenaSetupUI.GetComponent <ArenaSetup>();
 }