public StartGameInteraction(WaterWarsController controller, UUID playerId, OsButton button)
            : base(controller, playerId, button)
        {
            IDictionary <UUID, Player> players = controller.Game.Players;

            lock (players)
            {
                if (players.Count < 1)
                {
                    SendAlert(playerId, string.Format("Could not start game since no players are enrolled"));
                }
                else
                {
                    try
                    {
                        m_controller.State.StartGame();
                    }
                    catch (ConfigurationException e)
                    {
                        m_controller.Dispatcher.AlertConfigurationFailure(e.Message);
                        throw e;
                    }

//                    m_controller.Dispatcher.EnableRegistration(false);
//                    m_controller.Dispatcher.EnableStartGame(false);
                    m_controller.Groups.SendMessageToGroup("A new game has started.");

                    Scene scene = ButtonMap[playerId].Part.ParentGroup.Scene;
                    scene.SimChat("New Water Wars game started", WaterWarsConstants.SYSTEM_ANNOUNCEMENT_NAME);
                }
            }
        }
        public StartGameInteraction(WaterWarsController controller, UUID playerId, OsButton button)
            : base(controller, playerId, button)
        {
            IDictionary<UUID, Player> players = controller.Game.Players;

            lock (players)
            {
                if (players.Count < 1)
                {
                    SendAlert(playerId, string.Format("Could not start game since no players are enrolled"));
                }
                else
                {
                    try
                    {
                        m_controller.State.StartGame();
                    }
                    catch (ConfigurationException e)
                    {
                        m_controller.Dispatcher.AlertConfigurationFailure(e.Message);
                        throw e;
                    }

            //                    m_controller.Dispatcher.EnableRegistration(false);
            //                    m_controller.Dispatcher.EnableStartGame(false);
                    m_controller.Groups.SendMessageToGroup("A new game has started.");

                    Scene scene = ButtonMap[playerId].Part.ParentGroup.Scene;
                    scene.SimChat("New Water Wars game started", WaterWarsConstants.SYSTEM_ANNOUNCEMENT_NAME);
                }
            }
        }
Example #3
0
        protected override void RegisterPart(SceneObjectPart part)
        {
            if (part.Name == MONEY_BUTTON)
            {
                m_moneyButton = new MoneyButton(m_controller, part);
            }
            else if (part.Name == LAND_BUTTON)
            {
                m_landButton = new LandButton(m_controller, part);
            }
            else if (part.Name == WATER_BUTTON)
            {
                m_waterButton = new WaterButton(m_controller, part);
            }
//            else if (part.Name == MARKET_BUTTON)
//                m_marketButton = new MarketButton(m_controller, part);
            else if (part.Name == STATUS_BUTTON)
            {
                m_statusButton = new StatusButton(m_controller, part);
            }
            else if (part.Name == PHASE_BUTTON)
            {
                m_phaseButton = new PhaseButton(m_controller, part);
            }
            else if (part.Name == TIME_REMAINING_BUTTON)
            {
                m_timeRemainingButton = new TimeRemainingButton(m_controller, part);
            }
            else if (part.Name == END_TURN_BUTTON)
            {
                m_endTurnButton = new EndTurnButton(m_controller, part, UserId);
            }
            else if (part.Name == SHOW_BROWSER_BUTTON)
            {
                m_showBrowserButton = new ShowBrowserButton(m_controller, part, UserId);
            }
            else if (part.Name == TICKER_BUTTON)
            {
                m_tickerButton = new TickerButton(m_controller, part);
            }

            if (part.IsRoot)
            {
                RootLocalId = part.LocalId;

                // XXX: Nasty nasty nasty hack to resolve an issue where attached non-root prims do not always appear
//                SceneObjectGroup group = part.ParentGroup;
//                group.HasGroupChanged = true;
//                group.ScheduleGroupForFullUpdate();
            }
        }
        public RegisterInteraction(WaterWarsController controller, UUID playerId, OsButton button)
            : base(controller, playerId, button)
        {
            bool checksPassed = true;

            try
            {
                m_controller.Groups.CheckForRequiredSetup();
            }
            catch (GroupsSetupException e)
            {
                checksPassed = false;
                SendAlert(playerId, string.Format("Could not register to play.  {0}", e.Message));
            }

            if (!controller.HudManager.HasHud(playerId))
            {
                checksPassed = false;
                SendAlert(playerId,
                          "Please attach your Water Wars head-up display (HUD) before registering for the game."
                          + "  You can get a hud by clicking the state capital building.");
            }

            if (checksPassed)
            {
                UserAccount ua = m_controller.Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, playerId);

                if (!m_controller.Groups.IsPlayerInRequiredGroup(ua))
                {
                    m_controller.Groups.AddPlayerToRequiredGroup(ua);
                    SendAlert(playerId, string.Format("Adding you to group {0}", WaterWarsConstants.GROUP_NAME));
                }

                AskWhichRole(playerId);
            }
        }
        public RegisterInteraction(WaterWarsController controller, UUID playerId, OsButton button)
            : base(controller, playerId, button)
        {
            bool checksPassed = true;

            try
            {
                m_controller.Groups.CheckForRequiredSetup();
            }
            catch (GroupsSetupException e)
            {
                checksPassed = false;
                SendAlert(playerId, string.Format("Could not register to play.  {0}", e.Message));
            }

            if (!controller.HudManager.HasHud(playerId))
            {
                checksPassed = false;
                SendAlert(playerId,
                    "Please attach your Water Wars head-up display (HUD) before registering for the game."
                    + "  You can get a hud by clicking the state capital building.");
            }

            if (checksPassed)
            {
                UserAccount ua = m_controller.Scenes[0].UserAccountService.GetUserAccount(UUID.Zero, playerId);

                if (!m_controller.Groups.IsPlayerInRequiredGroup(ua))
                {
                    m_controller.Groups.AddPlayerToRequiredGroup(ua);
                    SendAlert(playerId, string.Format("Adding you to group {0}", WaterWarsConstants.GROUP_NAME));
                }

                AskWhichRole(playerId);
            }
        }
 /// <summary>
 /// Create an interaction for two users
 /// </summary>
 /// <param name="user1Id"></param>
 /// <param name="user1Button"></param>
 /// <param name="user2Id"></param>
 /// <param name="user2Button"></param>
 public AbstractInteraction(UUID user1Id, OsButton user1Button, UUID user2Id, OsButton user2Button)
 {
     ButtonMap = new Dictionary<UUID, OsButton>();
     ButtonMap.Add(user1Id, user1Button);
     ButtonMap.Add(user2Id, user2Button);
 }
 /// <summary>
 /// Create an interaction for a single user
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="button"></param>
 public AbstractInteraction(UUID userId, OsButton button)
 {
     ButtonMap = new Dictionary<UUID, OsButton>();
     ButtonMap.Add(userId, button);
 }
Example #8
0
        protected override void RegisterPart(SceneObjectPart part)
        {
            if (part.Name == MONEY_BUTTON)
                m_moneyButton = new MoneyButton(m_controller, part);
            else if (part.Name == LAND_BUTTON)
                m_landButton = new LandButton(m_controller, part);
            else if (part.Name == WATER_BUTTON)
                m_waterButton = new WaterButton(m_controller, part);
            //            else if (part.Name == MARKET_BUTTON)
            //                m_marketButton = new MarketButton(m_controller, part);
            else if (part.Name == STATUS_BUTTON)
                m_statusButton = new StatusButton(m_controller, part);
            else if (part.Name == PHASE_BUTTON)
                m_phaseButton = new PhaseButton(m_controller, part);
            else if (part.Name == TIME_REMAINING_BUTTON)
                m_timeRemainingButton = new TimeRemainingButton(m_controller, part);
            else if (part.Name == END_TURN_BUTTON)
                m_endTurnButton = new EndTurnButton(m_controller, part, UserId);
            else if (part.Name == SHOW_BROWSER_BUTTON)
                m_showBrowserButton = new ShowBrowserButton(m_controller, part, UserId);
            else if (part.Name == TICKER_BUTTON)
                m_tickerButton = new TickerButton(m_controller, part);

            if (part.IsRoot)
            {
                RootLocalId = part.LocalId;

                // XXX: Nasty nasty nasty hack to resolve an issue where attached non-root prims do not always appear
            //                SceneObjectGroup group = part.ParentGroup;
            //                group.HasGroupChanged = true;
            //                group.ScheduleGroupForFullUpdate();
            }
        }
 public WaterWarsInteraction(WaterWarsController controller, UUID playerId, OsButton button)
     : base(playerId, button)
 {
     m_controller = controller;
 }
 public WaterWarsInteraction(WaterWarsController controller, UUID playerId, OsButton button)
     : base(playerId, button)
 {
     m_controller = controller;
 }
 /// <summary>
 /// Create an interaction for two users
 /// </summary>
 /// <param name="user1Id"></param>
 /// <param name="user1Button"></param>
 /// <param name="user2Id"></param>
 /// <param name="user2Button"></param>
 public AbstractInteraction(UUID user1Id, OsButton user1Button, UUID user2Id, OsButton user2Button)
 {
     ButtonMap = new Dictionary <UUID, OsButton>();
     ButtonMap.Add(user1Id, user1Button);
     ButtonMap.Add(user2Id, user2Button);
 }
 /// <summary>
 /// Create an interaction for a single user
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="button"></param>
 public AbstractInteraction(UUID userId, OsButton button)
 {
     ButtonMap = new Dictionary <UUID, OsButton>();
     ButtonMap.Add(userId, button);
 }