Exemplo n.º 1
0
        private Hashtable GetCommandInfo(RaceCommand command)
        {
            Hashtable hash = new Hashtable();

            hash.Add(RaceCommandKey.COMMANDER, GetCommandMemberInfo(command.commander));
            hash.Add(RaceCommandKey.ADMIRAL1, GetCommandMemberInfo(command.firstAdmiral));
            hash.Add(RaceCommandKey.ADMIRAL2, GetCommandMemberInfo(command.secondAdmiral));
            return(hash);
        }
Exemplo n.º 2
0
        public RaceCommand GetCommand(int race)
        {
            RaceCommand command = null;

            if (mCommands.TryGetValue(race, out command))
            {
                return(command);
            }
            return(null);
        }
Exemplo n.º 3
0
 private void ClearCommandPlayers(RaceCommand command)
 {
     if (command.commander.has)
     {
         application.Players.SetRaceStatus(command.commander.gameRefID, command.commander.characterID, (int)RaceStatus.None);
     }
     if (command.firstAdmiral.has)
     {
         application.Players.SetRaceStatus(command.firstAdmiral.gameRefID, command.firstAdmiral.characterID, (int)RaceStatus.None);
     }
     if (command.secondAdmiral.has)
     {
         application.Players.SetRaceStatus(command.secondAdmiral.gameRefID, command.secondAdmiral.characterID, (int)RaceStatus.None);
     }
 }
Exemplo n.º 4
0
 public bool AddCommand(RaceCommand command)
 {
     if (mCommands.ContainsKey(command.race))
     {
         RaceCommand oldCommand;
         if (mCommands.TryRemove(command.race, out oldCommand))
         {
             return(mCommands.TryAdd(command.race, command));
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(mCommands.TryAdd(command.race, command));
     }
 }
Exemplo n.º 5
0
        public RaceCommand GetCommand(int race)
        {
            var command = cache.GetCommand(race);

            if (command != null)
            {
                return(command);
            }

            command = application.DB.RaceCommands.FindOne(Query <RaceCommand> .EQ(rc => rc.race, race));
            if (command != null)
            {
                if (cache.AddCommand(command))
                {
                    s_Log.InfoFormat("new command with commander character = {0} added to cache", command.commander.characterID);
                }
                else
                {
                    s_Log.InfoFormat("error of adding command to cache");
                }
                return(command);
            }
            else
            {
                command = new RaceCommand {
                    race          = race,
                    commander     = new RaceCommander(),
                    firstAdmiral  = new RaceAdmiral(),
                    secondAdmiral = new RaceAdmiral()
                };
                cache.AddCommand(command);
                cache.SetChanged(true);
                Save();
                return(command);
            }
        }