public FieldView( WaterWarsController controller, Scene scene, Field field, Vector3 scale, AbstractView itemStoreView) : base(controller, scene, itemStoreView) { m_field = field; m_scale = scale; }
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 ViewerWebServices(WaterWarsController controller) : base(controller) { m_buyPointServices = new BuyPointServices(m_controller); PlayerServices = new PlayerServices(m_controller); Initialise(); }
public OpenSimDispatcher(WaterWarsController controller) { m_controller = controller; m_controller.EventManager.OnGameAssetBuildStarted += CreateGameAssetView; // FIXME: If we use this again, we'll need to get one per scene since IScriptModuleComms is not shared m_scriptModuleComms = m_controller.Scenes[0].RequestModuleInterface <IScriptModuleComms>(); // m_scriptModuleComms.OnScriptCommand += ProcessScriptCommand; }
public OpenSimDispatcher(WaterWarsController controller) { m_controller = controller; m_controller.EventManager.OnGameAssetBuildStarted += CreateGameAssetView; // FIXME: If we use this again, we'll need to get one per scene since IScriptModuleComms is not shared m_scriptModuleComms = m_controller.Scenes[0].RequestModuleInterface<IScriptModuleComms>(); // m_scriptModuleComms.OnScriptCommand += ProcessScriptCommand; }
public AskWaterRightsBuyerInteraction( WaterWarsController controller, HudView sellerHud, HudView buyerHud, int salePrice, int amount) : base(controller, sellerHud, buyerHud) { if (!m_controller.Game.Players.TryGetValue(sellerHud.UserId, out m_seller)) return; if (!m_controller.Game.Players.TryGetValue(buyerHud.UserId, out m_buyer)) return; m_amount = amount; m_salePrice = salePrice; AskBuyer(); }
public AskLandBuyerInteraction( WaterWarsController controller, HudView playerHud, HudView targetPlayerHud, BuyPoint bp, int salePrice, RightsType rightsToSell) : base(controller, playerHud, targetPlayerHud) { m_bp = bp; if (!m_controller.Game.Players.TryGetValue(playerHud.UserId, out m_p)) return; if (!m_controller.Game.Players.TryGetValue(targetPlayerHud.UserId, out m_targetPlayer)) return; m_salePrice = salePrice; m_rightsToSell = rightsToSell; AskBuyer(); }
public void PostInitialise() { try { UserAccount economyUserAccount = m_scenes[0].UserAccountService.GetUserAccount( UUID.Zero, WaterWarsConstants.ECONOMY_PLAYER_FIRST_NAME, WaterWarsConstants.ECONOMY_PLAYER_LAST_NAME); if (null == economyUserAccount) { throw new Exception( string.Format( "Economy user \"{0} {1}\" not present. Please create this user before restarting", WaterWarsConstants.ECONOMY_PLAYER_FIRST_NAME, WaterWarsConstants.ECONOMY_PLAYER_LAST_NAME)); } m_controller = new WaterWarsController( m_scenes, null, new Recorder(new FileDestination()), new SimpleForecaster(), new SeriesRainfallGenerator(), new FairWaterDistributor(), new SimpleWaterAllocator(), new SimpleEconomicForecaster(), new SeriesEconomicGenerator(), new SimpleEconomicDistributor(), economyUserAccount); m_controller.Dispatcher = new OpenSimDispatcher(m_controller); m_controller.Initialise(true); } catch (Exception e) { m_log.ErrorFormat("[WATER WARS]: ERROR {0} {1}", e.Message, e.StackTrace); } }
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 ModelFactory(WaterWarsController controller) { m_controller = controller; }
public Events(WaterWarsController controller) { m_controller = controller; }
public HudViewManager(WaterWarsController controller) { m_controller = controller; }
public PreallocateLandToFarmers(WaterWarsController controller) { m_controller = controller; }
public RoundManager(WaterWarsController controller) { m_controller = controller; Reset(); }
public HudView(WaterWarsController controller, Scene scene, UUID userId) : base(controller, scene) { UserId = userId; m_controller.EventManager.OnStateStarted += ProcessStateStarted; m_controller.EventManager.OnPlayerEndedTurn += ProcessPlayerEndTurn; m_controller.EventManager.OnGameAssetSoldToEconomy += ProcessGameAssetSoldToEconomy; }
public OpenSimGroupsMediator(WaterWarsController controller) { m_controller = controller; }
public WaterWarsCommands(WaterWarsController controller) { m_controller = controller; }
public ShowBrowserButton(WaterWarsController controller, SceneObjectPart part, UUID playerId) : base(controller, part, new FadeInAndOutBehaviour()) { m_playerId = playerId; OnClick += delegate(Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { OpenMediaBrowser(); }; controller.EventManager.OnStateStarted += OnStateChange; Enabled = true; }
public OpenSimResolver(WaterWarsController controller) { m_controller = controller; }
public PhaseButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, new FixedTextureBehaviour()) { UpdateLabel(m_controller.Game.State); m_controller.EventManager.OnStateStarted += UpdateLabel; }
public MoneyButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, new FixedTextureBehaviour()) { Money = 0; }
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public EndTurnButton(WaterWarsController controller, SceneObjectPart part, UUID playerId) : base(controller, part, new FadeInAndOutBehaviour()) { DisplayBehaviour.Text = "end turn"; OnClick += delegate(Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { Util.FireAndForget(delegate { controller.State.EndTurn(playerId); }); }; }
public BuyPointViewButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, 4600, new FixedTextureBehaviour()) { Enabled = true; OnClick += delegate(Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { Util.FireAndForget( delegate { controller.ViewerWebServices.PlayerServices.SetLastSelected( remoteClient.AgentId, m_bp); }); }; }
public BuyPointServices(WaterWarsController controller) : base(controller) { }
public BuyPointView(WaterWarsController controller, Scene scene, AbstractView itemStoreView, BuyPoint bp) : base(controller, scene, itemStoreView) { m_bp = bp; m_bp.OnChange += Update; m_veSceneObjectNames[AbstractGameAssetType.None] = "For Sale"; m_veSceneObjectNames[AbstractGameAssetType.Crops] = "Farmhouse"; m_veSceneObjectNames[AbstractGameAssetType.Houses] = "Site Office"; m_veSceneObjectNames[AbstractGameAssetType.Factory] = "Portacabin"; }
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public StatusButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, 1471, new FixedTextureBehaviour()) { Enabled = true; // XXX: Temporarily enable so that it will pass on chat to the interaction hanging off it }
public GameDateManager(WaterWarsController controller) { m_controller = controller; }
public WaterWarsDecorator( WaterWarsController controller, Scene scene, AbstractView itemStoreView, string itemName, Vector3 positionToDisplay) : base(scene, itemStoreView, itemName, positionToDisplay) { m_controller = controller; }
public TickerButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, new FixedTextureBehaviour()) { m_emptyCrawler = new string(' ', m_widthAvailable); m_visibleTickText = new StringBuilder(m_emptyCrawler); CrawlSeperator = " ... "; // AddTextToTick("Shall I compare thee to a summer's day? Thou art more lovely and more temperate." // + " Rough winds do shake the darling buds of May. And summer's lease hath all too short a date." // + " Sometime too hot the eye of heaven shines. And often is his gold complexion dimm'd." // + " And every fair from fair somtimes declines. By chance, or nature's changing course, untrimm'd."); m_controller.EventManager.OnStateStarted += OnStateStarted; m_timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); m_timer.Start(); }
// /// <summary> // /// Should only be used externally by tests // /// </summary> // public ISessionFactory m_sessionFactory; public void Initialize(WaterWarsController controller) { m_controller = controller; // // var cfg = new Configuration(); // cfg.Configure(); // cfg.AddAssembly(typeof (Houses).Assembly); // // // This defeats the whole point of persistence at the moment. Need to do this conditionally depending // // on whether the table already exists // new SchemaExport(cfg).Create(true, true); // // m_sessionFactory = cfg.BuildSessionFactory(); // // if (m_controller.Scenes.Count > 0) // m_controller.Scenes[0].EventManager.OnShutdown += Close; // // m_controller.EventManager.OnSystemInitialized += SystemInitialized; // m_controller.EventManager.OnBuyPointRegistered += Save; // m_controller.EventManager.OnStateChanged += StateChanged; // // m_controller.EventManager.OnPlayerAdded += Save; // // m_controller.EventManager.OnGameStarted += UpdateGameBuyPointsAndPlayers; // m_controller.EventManager.OnGameReset += ResetGame; // m_controller.EventManager.OnWaterStageStarted += WaterStageStarted; // m_controller.EventManager.OnRevenueStageEnded += RevenueStageEnded; // // m_controller.EventManager.OnBuyPointNameChanged += Update; // m_controller.EventManager.OnLandRightsBought += LandRightsBought; // m_controller.EventManager.OnLandRightsSold += LandRightsSold; // m_controller.EventManager.OnGameAssetBought += GameAssetBought; // m_controller.EventManager.OnGameAssetSold += Delete; // m_controller.EventManager.OnGameAssetUpgraded += UpgradeGameAsset; // // m_controller.EventManager.OnWaterUsed += WaterUsed; // m_controller.EventManager.OnWaterSold += WaterSold; }
public TimeRemainingButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, new FixedTextureBehaviour()) { TimeRemaining = 0; }
public GameResettingState(WaterWarsController controller) : base(controller, GameStateType.Game_Resetting) { }
public WaterButton(WaterWarsController controller, SceneObjectPart part) : base(controller, part, new FixedTextureBehaviour()) { Water = 0; WaterEntitlement = 0; }
public AskWaterBuyerInteraction( WaterWarsController controller, HudView playerHud, HudView targetPlayerHud, int amount, int salePrice) : base(controller, playerHud, targetPlayerHud) { if (!m_controller.Game.Players.TryGetValue(playerHud.UserId, out m_player)) return; if (!m_controller.Game.Players.TryGetValue(targetPlayerHud.UserId, out m_targetPlayer)) return; m_salePrice = salePrice; m_waterToSell = amount; AskBuyer(); }
/// <summary> /// Constructor. /// </summary> /// <param name="controller"></param> public BuildStageState(WaterWarsController controller) : base(controller, GameStateType.Build) { }