private static string PlayGameTwoPlayers() { var game = _saveGame ?? new Game(GameSettings.Settings?.BoardHeight ?? 6, GameSettings.Settings?.BoardWidth ?? 7); var done = false; while (!done) { Console.Clear(); GameInterface.PrintBoard(game); var nextTurn = false; var player = game.FirstPlayersMove ? "Player 1, " : "Player 2, "; while (!nextTurn) { var column = InputHandler.GetUserIntInput(player + GameInterface.ChoiceQuestion, 0, game.Width - 1, GameInterface.NoColumnMessage, true); if (!column.HasValue) { SaveGame(game, 0); return(""); } nextTurn = game.DropDisc(column); if (!nextTurn) { Console.WriteLine(GameInterface.ColumnFullMessage); } } done = game.CheckGameEnd() || game.CheckWinner(); } string message; if (game.CheckGameEnd()) { message = "Draw!"; } else { message = game.FirstPlayerWinner ? "Player 1 wins!" : "Player 2 wins!"; } Console.Clear(); GameInterface.PrintBoard(game); Console.WriteLine(message); Console.Write("Press any key to continue..."); Console.ReadKey(); return(""); }
public void OnStart(GameInterface game) { this.game = game; settingsInstance = this.LoadSettingsJSON <Settings>(); dynamic libSMS = Utilities.GetReferenceOfPlugin("LibSMS"); if (libSMS == null) { this.ShowNotify("LibSMS isn't found! Plugin will not work.", true, true); this.LogPrint("LibSMS isn't found! Plugin will not work."); return; } if (libSMS.GetType().GetMethod("SendSMS") == null) { this.ShowNotify("LibSMS.SendSMS method isn't found! Plugin will not work.", true, true); this.LogPrint("LibSMS.SendSMS method isn't found! Plugin will not work."); return; } this.LogPrint("LibSMS is OK"); if (settingsInstance.OnWhisper || settingsInstance.OnBNetWhisper) { // we don't want to read old messages game.ReadChat().ToArray(); (timerChat = this.CreateTimer(1000, game, TimerChat_OnElapsed)).Start(); this.LogPrint("Whisper notification enabled"); } if (settingsInstance.OnStaticPopup) { (timerStaticPopup = this.CreateTimer(15000, game, TimerStaticPopup_OnElapsed)).Start(); foreach (var i in PopupFrames) { this.LogPrint($"{i.Item1} --> {i.Item2}"); } this.LogPrint("StaticPopup notification enabled"); } if (settingsInstance.OnDisconnect) { timerDisconnect = new System.Timers.Timer(100); timerDisconnect.Elapsed += TimerDisconnect_OnElapsed; timerDisconnect.Start(); this.LogPrint("Disconnect notification enabled"); } running = true; this.LogPrint("Successfully started"); }
protected virtual bool CanMoveTo(GameInterface gameInterface, WorldPosition destination) { IWorldPositionningService service = gameInterface.Game.Services.GetService <IWorldPositionningService>(); Region region = service.GetRegion(this.army.WorldPosition); if (region == null || !region.BelongToEmpire(this.army.Empire) || region.City == null || region.City.BesiegingEmpire == null) { return(true); } bool flag = region.City.Districts.Any((District match) => match.Type != DistrictType.Exploitation && match.WorldPosition == this.army.WorldPosition); bool flag2 = region.City.Districts.Any((District match) => match.Type != DistrictType.Exploitation && match.WorldPosition == destination); if (flag) { return(flag2); } return(!flag2); }
public virtual void Target() { wowProcess.WaitWhileWoWIsMinimized(); info = info ?? new GameInterface(wowProcess); if (info.IsInGame) { if (Settings2.Instance.WoWTargetMouseover != Keys.None) { SetMouseoverUnit(GUID); NativeMethods.SendMessage(wowProcess.MainWindowHandle, Win32Consts.WM_KEYDOWN, (IntPtr)Settings2.Instance.WoWTargetMouseover, IntPtr.Zero); NativeMethods.SendMessage(wowProcess.MainWindowHandle, Win32Consts.WM_KEYUP, (IntPtr)Settings2.Instance.WoWTargetMouseover, IntPtr.Zero); } else { Notify.TrayPopup("Attention!", "Please set up WoW internal keybinds in <Settings2 -> World of Warcraft -> Ingame key binds>", NotifyUserType.Warn, true); Thread.Sleep(3000); } } }
internal Radar(GameInterface game) { InitializeComponent(); using (Bitmap bitmap = new Bitmap(ImagesBase64.Icon)) { Icon = Icon.FromHandle(bitmap.GetHicon()); } info = game; settings = this.LoadSettingsJSON <Settings>(); SetupBrushes(settings); settings.List.CollectionChanged += WoWRadarListChanged; UpdateCaches(); checkBoxFriends.ForeColor = settings.FriendColor; checkBoxEnemies.ForeColor = settings.EnemyColor; checkBoxNpcs.ForeColor = settings.NPCColor; checkBoxObjects.ForeColor = settings.ObjectColor; halfOfPictureboxSize = pictureBoxMain.Width / 2; checkBoxFriends.Checked = settings.DisplayFriends; checkBoxEnemies.Checked = settings.DisplayEnemies; checkBoxNpcs.Checked = settings.DisplayNpcs; checkBoxObjects.Checked = settings.DisplayObjects; checkBoxCorpses.Checked = settings.DisplayCorpses; zoomR = settings.Zoom; checkBoxFriends.CheckedChanged += SaveCheckBoxes; checkBoxEnemies.CheckedChanged += SaveCheckBoxes; checkBoxNpcs.CheckedChanged += SaveCheckBoxes; checkBoxObjects.CheckedChanged += SaveCheckBoxes; checkBoxCorpses.CheckedChanged += SaveCheckBoxes; thread = new Thread(Redraw); MouseWheel += OnMouseWheel; pictureBoxMain.MouseWheel += OnMouseWheel; Task.Factory.StartNew(() => { Thread.Sleep(6000); BeginInvoke((MethodInvoker)(() => { labelHint.Visible = false; })); }); this.LogPrint("Loaded"); }
public Game(IEnumerable <IPlayer> players, Action <string, IGameInterface> inject) { if (players.Count() != 2) { throw new ArgumentException("names must contain 2 elements", "names"); } _board = BoardBuilder.CreateTwoPlayer(); _numberOfTurns = 10; _availableTribes = new AvailableTribes(); var dice = new Dice(new Random(88)); foreach (var player in players) { var gi = new GameInterface(player.Name, this); _players.Add(player); _gis.Add(gi); inject(player.Name, gi); } }
void Start() { if (Instance == null) { Instance = this; } mapGeneratorPanel.SetActive(true); if (GameManager.LevelStarted && respawnPosition == null) { respawnPosition = GameObject.FindGameObjectWithTag("Respawn").transform.position; } if (PlayerPrefs.HasKey("MiniMapAlpha")) { miniMapAlphaSlider.value = PlayerPrefs.GetFloat("MiniMapAlpha"); } }
public void OnStart(GameInterface game) { this.game = game; SettingsInstance = this.LoadSettingsJSON <InkCrafterSettings>(); startupTask = Task.Run(() => { this.ShowNotify("Please wait while plugin set up inks lists...", false, false); game.SendToChat($"/run {tableNames} = {{}};"); game.SendToChat($"/run {tableAvailable} = {{}};"); game.SendToChat($"/run {tableIndexes} = {{}};"); game.SendToChat($"/run {tableRemain} = {{}};"); foreach (string ink in inks) { game.SendToChat($"/run {tableNames}[\"{ink}\"] = true;"); game.SendToChat($"/run {tableRemain}[\"{ink}\"] = {(ink == "Чернила разжигателя войны" ? SettingsInstance.WarbindersInkCount : 0)};"); } this.ShowNotify("Completed, starting to craft", false, false); (timer = this.CreateTimer(1000, game, OnPulse)).Start(); }); }
private static void CallRaw(uint identifier, params Parameter[] parameters) { for (int index = parameters.Length - 1; index >= 0; --index) { parameters[index].PushValue(); } GameInterface.Script_Call((int)identifier, _entRef, parameters.Length); SetEntRef(-1); _returnValue = null; if (GameInterface.Notify_NumArgs() == 1) { switch (GameInterface.Script_GetType(0)) { case VariableType.Entity: _returnValue = Entity.GetEntity(GameInterface.Script_GetEntRef(0)); break; case VariableType.String: case VariableType.IString: _returnValue = GameInterface.Script_GetString(0); break; case VariableType.Vector: GameInterface.Script_GetVector(0, out Vector3 vector); _returnValue = vector; break; case VariableType.Float: _returnValue = GameInterface.Script_GetFloat(0); break; case VariableType.Integer: _returnValue = GameInterface.Script_GetInt(0); break; } } GameInterface.Script_CleanReturnStack(); }
public void OnStart(GameInterface game) { this.game = game; dynamic libSMS = Utilities.GetReferenceOfPlugin("LibSMS"); if (libSMS == null) { this.ShowNotify("LibSMS isn't found! Plugin will not work.", true, true); this.LogPrint("LibSMS isn't found! Plugin will not work."); return; } if (libSMS.GetType().GetMethod("SendSMS") == null) { this.ShowNotify("LibSMS.SendSMS method isn't found! Plugin will not work.", true, true); this.LogPrint("LibSMS.SendSMS method isn't found! Plugin will not work."); return; } this.LogPrint("LibSMS is OK"); lastTimeSmsSent = DateTime.MinValue; (timer = this.CreateTimer(50, game, TimerElapsed)).Start(); }
public void UpdateYear(int year) { timeManager.Year = year; GUI.ClearSelectedBuildingIcon(); if (GameMap.ChangesMade) { UpdatePopulation(); UpdateMonetaryHistory(); } GUI.SetPopulation((int)popManager.GetPopulation(CurrentYear)); GUI.SetMoney(GetMoney(CurrentYear)); GUI.SetParameters(popManager.GetConsumptionCoverage(CurrentYear)); GameMap.ResetYearlyParameters(); GameInterface.SetOverpopulationStatus(popManager.Overpopulation(CurrentYear)); Debug.AddToLog(popManager); SoundManager.StopBackgroundSong(); SoundManager.StartBackgroundSong(); }
protected override void Initialize(DemoConfiguration demoConfiguration) { base.Initialize(demoConfiguration); _infoGamePanel = Helpers.LoadFromFile(RenderTarget2D, "gameInfo.png"); GameInterface = new GameInterface(RenderTarget2D, RESOLUTION, FactoryDWrite); BuildingsFactory = new BuildingsFactory(RenderTarget2D, GameInterface); _myCharacter = new Character(RenderTarget2D, BuildingsFactory, "Серафим"); PlayersFactory = new PlayersFactory(RenderTarget2D, GameInterface, _myCharacter); MobsFactory = new MobsFactory(RenderTarget2D, GameInterface); GameStats = new GameStats(PlayersFactory, BuildingsFactory, null); GameStats.Money = 100; GameStats.Woods = 100; _myCharacter.eventCreateTower += (CommonTower tower) => { GameStats.Money -= (int)tower.Id; GameStats.Woods -= (int)tower.Id; }; GameInterface.SetGameStats(GameStats); _timeLastDraw = 0; _timeLastUpdate = 0; gameState = new GameState(); mainMenu = new MainMenu(RenderTarget2D, RESOLUTION); SoundsManager.init(); AudioPlayer sound = new AudioPlayer("goobye.mp3"); sound.Volume = 0.04f; sound.Play(); Connector.ConnectWithServer(); }
public void OnStart(GameInterface inf) { game = inf; settings = this.LoadSettingsJSON <Settings>(); if (settings.MillFelwort) { herbs.Add(124106); // Felwort item id } lastNotifiedAboutCompletion = DateTime.MinValue; if (inf.IsSpellKnown(51005)) // mill { this.LogPrint("Milling: OK"); } if (inf.IsSpellKnown(31252)) // prospect { this.LogPrint("Prospecting: OK"); } if (inf.IsSpellKnown(13262)) // disenchant { this.LogPrint("Disenchanting: OK"); } (timer = this.CreateTimer(50, inf, OnPulse)).Start(); }
public static IEnumerable <BlackMarketItem> GetAllItems(GameInterface game) { if (game.IsInGame) { var numItems = game.Memory.Read <uint>(game.Memory.ImageBase + WowBuildInfoX64.BlackMarketNumItems); if (numItems != 0) { var baseAddr = game.Memory.Read <IntPtr>(game.Memory.ImageBase + WowBuildInfoX64.BlackMarketItems); for (uint i = 0; i < numItems; ++i) { var finalAddr = (int)(baseAddr + (int)(i * sizeofBmItem)); BlackMarketItemInternal item = game.Memory.Read <BlackMarketItemInternal>(new IntPtr(finalAddr)); yield return(new BlackMarketItem { Name = Wowhead.GetItemInfo(item.Entry).Name, Image = Wowhead.GetItemInfo(item.Entry).Image, TimeLeft = TimeSpan.FromSeconds(item.TimeLeft), LastBidGold = (int)(item.currBid > 0 ? (uint)(item.currBid / 10000) : item.NextBid / 10000), NumBids = (int)item.NumBids }); } } } }
static void Main(string[] args) { TextReader inputReader = Console.In; IGameInterface gameInterface = new GameInterface(NUMBER_OF_CARDS_IN_HAND); ICardShuffler shuffler = new CardShuffler(); ICardDealer cardDealer = new CardDealer(NUMBER_OF_CARDS_IN_DECK, shuffler); ICardMapper cardMapper = new CardMapper(); ICardMapperForUI cardMapperForUI = new CardMapperForUI(); Hand hand = new Hand(NUMBER_OF_CARDS_IN_HAND); IEvaluator evaluator = new Evaluator(cardMapper); CombinationNameAndPayoutMapper resultMapper = new CombinationNameAndPayoutMapper(); Game game = new Game( inputReader, gameInterface, cardDealer, cardMapper, cardMapperForUI, hand, evaluator, resultMapper); game.PlayGame(); }
//Init public Chatbox(Canvas gameCanvas, GameInterface gameUi) { mGameUi = gameUi; //Chatbox Window mChatboxWindow = new ImagePanel(gameCanvas, "ChatboxWindow"); mChatboxMessages = new ListBox(mChatboxWindow, "MessageList"); mChatboxMessages.EnableScroll(false, true); mChatboxWindow.ShouldCacheToTexture = true; mChatboxTitle = new Label(mChatboxWindow, "ChatboxTitle"); mChatboxTitle.Text = Strings.Chatbox.title; mChatboxTitle.IsHidden = true; mChatbar = new ImagePanel(mChatboxWindow, "Chatbar"); mChatbar.IsHidden = true; mChatboxInput = new TextBox(mChatboxWindow, "ChatboxInputField"); mChatboxInput.SubmitPressed += ChatBoxInput_SubmitPressed; mChatboxInput.Text = GetDefaultInputText(); mChatboxInput.Clicked += ChatBoxInput_Clicked; mChatboxInput.IsTabable = false; mChatboxInput.SetMaxLength(Options.MaxChatLength); Interface.FocusElements.Add(mChatboxInput); mChannelLabel = new Label(mChatboxWindow, "ChannelLabel"); mChannelLabel.Text = Strings.Chatbox.channel; mChannelLabel.IsHidden = true; mChannelCombobox = new ComboBox(mChatboxWindow, "ChatChannelCombobox"); for (var i = 0; i < 3; i++) { var menuItem = mChannelCombobox.AddItem(Strings.Chatbox.channels[i]); menuItem.UserData = i; } //Add admin channel only if power > 0. if (Globals.Me.Type > 0) { var menuItem = mChannelCombobox.AddItem(Strings.Chatbox.channeladmin); menuItem.UserData = 3; } mChatboxText = new Label(mChatboxWindow); mChatboxText.Name = "ChatboxText"; mChatboxText.Font = mChatboxWindow.Parent.Skin.DefaultFont; mChatboxSendButton = new Button(mChatboxWindow, "ChatboxSendButton"); mChatboxSendButton.Text = Strings.Chatbox.send; mChatboxSendButton.Clicked += ChatBoxSendBtn_Clicked; mChatboxWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString()); mChatboxText.IsHidden = true; // Platform check, are we capable of copy/pasting on this machine? if (GameClipboard.Instance == null || !GameClipboard.Instance.CanCopyPaste()) { ChatboxMsg.AddMessage(new ChatboxMsg(Strings.Chatbox.UnableToCopy, CustomColors.Alerts.Error)); } }
// Use this for initialization void Start() { gameInterface = GameObject.FindGameObjectWithTag ("game interface").GetComponent<GameInterface>(); ratio = backgroundArrow.height/(float)backgroundArrow.width; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Window.Title = "Asteria"; IsMouseVisible = true; graphics.PreferredBackBufferWidth = 1440; graphics.PreferredBackBufferHeight = 900; graphics.IsFullScreen = false; graphics.ApplyChanges(); logger = new Logger("Asteria.log"); Logger.MessageReceived += new LoggerMsgEvent(ToLog); context = new Context(); context.Protocol = "0.1"; context.Game = this; config = new Config(); config.LoadDefaultConfig(); // Create texture manager to draw textures from. textureManager = new TextureManager(); // Create input manager to handle mouse/keyboard states. inputManager = new InputManager(context); context.Input = inputManager; // Create the zonemanager. zoneManager = new ZoneManager(context); context.ZoneManager = zoneManager; // Create the game interface. gameInterface = new GameInterface(context); context.Gui = gameInterface; gameInterface.InitInterface(); // Create the game network. gameNetwork = new GameNetwork(context); gameNetwork.ConnectToWorld("127.0.0.1", 5961, 1, "admin_testing"); context.Network = gameNetwork; // Create world manager. worldManager = new WorldManager(context); context.WorldManager = worldManager; base.Initialize(); }
private void Initialize() { camera = new Camera(ScreenManager.GraphicsDevice.Viewport); //camera.AttachMap(map); GameManager.TheGameManager.Content = content; GameManager.TheGameManager.AttachGraphicsDevice(ScreenManager.GraphicsDevice); gameInterface = new GameInterface(); GameManager.TheGameManager.AttachGameInterface(gameInterface); GameManager.TheGameManager.AttachCamera(camera); GameManager.TheGameManager.LoadGlobalAssets(); GameManager.TheGameManager.LoadScenario(MAPNAME); GameManager.TheGameManager.PostInitialize(); }
public bool IsInterfaceOpen(GameInterface gameInterface) { return(interfaceGameObjectDictionary[gameInterface].activeSelf); }
public override bool Load() { clientHandledData = new Queue <NetworkData>(); client = Param["Client"] as Client; byteReader = Param["ByteReader"] as TcpByteReader; client.Closed += client_Closed; byteReader.ByteReaded += TcpByteReader_ByteReaded; gameRule = Param["GameRule"] as GameRule; userList = new ChangableList <User>(Param["Users"] as User[]); var songInformation = Param["SongInformation"] as SongInformation; var difficulty = (Difficulty)Param["Difficulty"]; var allowedModList = (AllowedModList)Param["AllowedModList"]; selfUser = Param["Self"] as User; userPlayStateList = new ChangableList <UserPlayState>(); userPlayStateList.ItemChanged += userPlayStateList_ItemChanged; userScoreListComponent = new UserScoreListComponent(device, ResourceManager) { Position = new SharpDX.Vector2(680, 45) }; itemManagerComponent = new ItemManagerComponent(device, ResourceManager, gameRule) { Position = new SharpDX.Vector2(682, 420) }; itemOverrayComponent = new ItemOverrayComponent(device, ResourceManager, itemManagerComponent); itemOverrayComponent.ItemSet += itemOverrayComponent_ItemSet; selfPlayState = new UserPlayState { User = selfUser }; foreach (User user in userList) { var userPlayState = new UserPlayState { User = user }; if (user == selfUser) { userScoreListComponent.AddSelfUser(selfPlayState, itemManagerComponent); } else { userPlayStateList.Add(userPlayState); userScoreListComponent.AddUser(userPlayState); } } userScoreListComponent.AddFinish(); black = new RectangleComponent(device, ResourceManager, PPDColors.Black) { RectangleHeight = 450, RectangleWidth = 800, Alpha = 0, Hidden = true }; // メインゲーム用のパラメータの準備 gameutility = new PPDGameUtility { SongInformation = songInformation, Difficulty = difficulty, DifficultString = songInformation.GetDifficultyString(difficulty), Profile = ProfileManager.Instance.Default, AutoMode = AutoMode.None, SpeedScale = 1, Random = false, MuteSE = (bool)Param["MuteSE"], Connect = (bool)Param["Connect"], IsDebug = true, GodMode = true, CanApplyModCallback = m => allowedModList.IsAllowed(m.FileHashString) || !m.ContainsModifyData }; GameInterfaceBase cgi = new GameInterface(device) { Sound = Sound, PPDGameUtility = gameutility, ResourceManager = ResourceManager }; cgi.Load(); pauseMenu = null; if (selfUser.IsLeader) { pauseMenu = new PauseMenu(device) { Sound = Sound, ResourceManager = ResourceManager }; pauseMenu.Load(); pauseMenu.Resumed += pauseMenu_Resumed; pauseMenu.Returned += pauseMenu_Returned; } config = new MainGameConfig(itemManagerComponent); mainGameComponent = new MainGameComponent(device, GameHost, ResourceManager, Sound, this, gameutility, cgi, new MarkImagePaths(), null, pauseMenu, config, songInformation.StartTime, songInformation.StartTime) { PauseMovieWhenPause = false }; filterSprite = new SpriteObject(device); mainGameComponent.Finished += mainGameComponent_Finished; mainGameComponent.Drawed += mainGameComponent_Drawed; mainGameComponent.ScoreChanged += mainGameComponent_ScoreChanged; mainGameComponent.LifeChanged += mainGameComponent_LifeChanged; mainGameComponent.EvaluateChanged += mainGameComponent_EvaluateChanged; mainGameComponent.ComboChanged += mainGameComponent_ComboChanged; mainGameComponent.Initialize(fadeOut, fadeOut, new Dictionary <string, object> { { "MultiItemComponent", itemManagerComponent } }); this.AddChild(black); shouldDisposeItem.AddRange(new GameComponent[] { userScoreListComponent, itemManagerComponent, itemOverrayComponent, mainGameComponent, filterSprite, pauseMenu }); ConnectExpansion(); client.Write(MessagePackSerializer.Serialize(new MainGameLoadedNetworkData())); return(true); }
public void OnStart(GameInterface game) { this.game = game; (mainForm = new MainForm(this, game)).Show(); (timer = this.CreateTimer(250, game, OnPulse)).Start(); }
static void Main(string[] args) { GameInterface.RunGame(); Console.ReadKey(); }
//Gwen Low Level Functions public static void InitGwen() { //TODO: Make it easier to modify skin. if (Skin == null) { Skin = new TexturedBase( GwenRenderer, Globals.ContentManager.GetTexture(GameContentManager.TextureType.Gui, "defaultskin.png") ) { DefaultFont = Graphics.UIFont }; } MenuUi?.Dispose(); GameUi?.Dispose(); // Create a Canvas (it's root, on which all other GWEN controls are created) sMenuCanvas = new Canvas(Skin, "MainMenu") { Scale = 1f //(GameGraphics.Renderer.GetScreenWidth()/1920f); }; sMenuCanvas.SetSize( (int)(Graphics.Renderer.GetScreenWidth() / sMenuCanvas.Scale), (int)(Graphics.Renderer.GetScreenHeight() / sMenuCanvas.Scale) ); sMenuCanvas.ShouldDrawBackground = false; sMenuCanvas.BackgroundColor = Color.FromArgb(255, 150, 170, 170); sMenuCanvas.KeyboardInputEnabled = true; // Create the game Canvas (it's root, on which all other GWEN controls are created) sGameCanvas = new Canvas(Skin, "InGame"); //_gameCanvas.Scale = (GameGraphics.Renderer.GetScreenWidth() / 1920f); sGameCanvas.SetSize( (int)(Graphics.Renderer.GetScreenWidth() / sGameCanvas.Scale), (int)(Graphics.Renderer.GetScreenHeight() / sGameCanvas.Scale) ); sGameCanvas.ShouldDrawBackground = false; sGameCanvas.BackgroundColor = Color.FromArgb(255, 150, 170, 170); sGameCanvas.KeyboardInputEnabled = true; // Create GWEN input processor if (Globals.GameState == GameStates.Intro || Globals.GameState == GameStates.Menu) { GwenInput.Initialize(sMenuCanvas); } else { GwenInput.Initialize(sGameCanvas); } FocusElements = new List <Framework.Gwen.Control.Base>(); InputBlockingElements = new List <Framework.Gwen.Control.Base>(); ErrorMsgHandler = new ErrorHandler(sMenuCanvas, sGameCanvas); if (Globals.GameState == GameStates.Intro || Globals.GameState == GameStates.Menu) { MenuUi = new MenuGuiBase(sMenuCanvas); GameUi = null; } else { GameUi = new GameInterface(sGameCanvas); MenuUi = null; } Globals.OnLifecycleChangeState(); GwenInitialized = true; }
void outTower_isMouseOver(CommonTower tower) { GameInterface.InfoTower(tower); }
public HomeController(GameInterface gi) { game = gi; }
public MobsFactory(RenderTarget RenderTarget2D, GameInterface GameInterface) : base(RenderTarget2D, GameInterface) { _mobs = new List <CommonMob>(); }
// Init the plugin public override void init() { // We need the match start and the match stop signal m_gameInterface = InterfaceFactory.gameInterface(); m_gameInterface.MatchStarted += new GameInterface.MatchStartedHandler(gi_MatchStarted); m_gameInterface.MatchEnded += new GameInterface.MatchEndedHandler(gi_MatchEnded); // Set the option dialog sytle System.Windows.Forms.Application.EnableVisualStyles(); // Instanciate the form dialog member, read persistent settings and hide the options dialog m_optionsDialog = new FormOptions(); m_optionsDialog.initAllItems(); m_optionsDialog.Hide(); // Listen to the form dialog event "OnReminderActivated", that means activation sttaus of the plugin // has been changed FormOptions.OnReminderEvent += new FormOptions.OnReminderActivated(Reminder_OnActivatedEvent); // show icon showIcon(Properties.Settings.Default.Active); setTooltip("CS Reminder Plugin"); // Watcher class, which observes the debug output of the CS process m_watch = new Watcher(); Watcher.OnPlayerEvent += new Watcher.OnPlayerEventHandler(Player_OnPlayerEvent); // Timer for notification TimerCallback tcb = CheckStatus; m_timer = new System.Threading.Timer(tcb); StopTimer(); }
public void OnStart(GameInterface game) { this.game = game; timer = this.CreateTimer(50, game, OnPulse); timer.Start(); }
public override void Load() { random = new Random(); background = new GameBackground(); AddChild(background); background.Y += GameMain.ScreenHeight * 0.2f; gameContainer = new Sprite(); AddChild(gameContainer); player = new Player(); player.X = 5 * Level.TILE_SIZE; player.Y = 5 * Level.TILE_SIZE; objects = new List<MovingObject>(); objects.Add(player); bullets = new List<Bullet>(); particleTexture = Assets.GetBitmapData("blood"); particles = new List<Particle>(); level = new Level(1); gameContainer.AddChild(level); gameInterface = new GameInterface(); #if __MOBILE__ AddChild(gameInterface); gameInterface.left.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin); gameInterface.right.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin); gameInterface.up.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin); gameInterface.left.AddEventListener(Event.TOUCH_END, buttonTouchEnd); gameInterface.right.AddEventListener(Event.TOUCH_END, buttonTouchEnd); gameInterface.up.AddEventListener(Event.TOUCH_END, buttonTouchEnd); gameInterface.fire.AddEventListener(Event.TOUCH_BEGIN, buttonTouchBegin); #endif inputX = 0; inputY = 0; tutorText = new TextField(); tutorText.font = Assets.GetFont("MainFont"); tutorText.text = "JUMP!!!"; tutorText.X = (PHYS_BEGIN + 1) * Level.TILE_SIZE; tutorText.Y = 5 * Level.TILE_SIZE; gameContainer.AddChild(player); var zombie = new Zombie(player); gameContainer.AddChild(zombie); objects.Add(zombie); zombie.X = 5 * Level.TILE_SIZE; zombie.Y = 5 * Level.TILE_SIZE; zombie = new Zombie(player); gameContainer.AddChild(zombie); objects.Add(zombie); zombie.X = 10 * Level.TILE_SIZE; zombie.Y = 6 * Level.TILE_SIZE; zombie = new Zombie(player); gameContainer.AddChild(zombie); objects.Add(zombie); zombie.X = 11 * Level.TILE_SIZE; zombie.Y = 5 * Level.TILE_SIZE; var zombie2 = new Bug(player); gameContainer.AddChild(zombie2); objects.Add(zombie2); zombie2.X = 7 * Level.TILE_SIZE; zombie2.Y = 4 * Level.TILE_SIZE; zombie2 = new Bug(player); gameContainer.AddChild(zombie2); objects.Add(zombie2); zombie2.X = 15 * Level.TILE_SIZE; zombie2.Y = 9 * Level.TILE_SIZE; zombie = new Zombie(player); gameContainer.AddChild(zombie); objects.Add(zombie); zombie.X = 30 * Level.TILE_SIZE; zombie.Y = 5 * Level.TILE_SIZE; zombie = new Zombie(player); gameContainer.AddChild(zombie); objects.Add(zombie); zombie.X = 32 * Level.TILE_SIZE; zombie.Y = 6 * Level.TILE_SIZE; zombie = new Zombie(player); gameContainer.AddChild(zombie); objects.Add(zombie); zombie.X = 35 * Level.TILE_SIZE; zombie.Y = 5 * Level.TILE_SIZE; zombie2 = new Bug(player); gameContainer.AddChild(zombie2); objects.Add(zombie2); zombie2.X = 40 * Level.TILE_SIZE; zombie2.Y = 8 * Level.TILE_SIZE; zombie2 = new Bug(player); gameContainer.AddChild(zombie2); objects.Add(zombie2); zombie2.X = 55 * Level.TILE_SIZE; zombie2.Y = 9 * Level.TILE_SIZE; gameContainer.AddChild(tutorText); }
public BuildingsFactory(RenderTarget RenderTarget2D, GameInterface GameInterface) : base(RenderTarget2D, GameInterface) { _towers = new List <CommonTower>(); }
//Init public Chatbox(Canvas gameCanvas, GameInterface gameUi) { mGameUi = gameUi; //Chatbox Window mChatboxWindow = new ImagePanel(gameCanvas, "ChatboxWindow"); mChatboxMessages = new ListBox(mChatboxWindow, "MessageList"); mChatboxMessages.EnableScroll(false, true); mChatboxWindow.ShouldCacheToTexture = true; mChatboxTitle = new Label(mChatboxWindow, "ChatboxTitle"); mChatboxTitle.Text = Strings.Chatbox.title; mChatboxTitle.IsHidden = true; // Generate tab butons. for (var btn = 0; btn < (int)ChatboxTab.Count; btn++) { mTabButtons.Add((ChatboxTab)btn, new Button(mChatboxWindow, $"{(ChatboxTab)btn}TabButton")); // Do we have a localized string for this chat tab? If not assign none as the text. LocalizedString name; mTabButtons[(ChatboxTab)btn].Text = Strings.Chatbox.ChatTabButtons.TryGetValue((ChatboxTab)btn, out name) ? name : Strings.General.none; mTabButtons[(ChatboxTab)btn].Clicked += TabButtonClicked; // We'll be using the user data to determine which tab we've clicked later. mTabButtons[(ChatboxTab)btn].UserData = (ChatboxTab)btn; } mChatbar = new ImagePanel(mChatboxWindow, "Chatbar"); mChatbar.IsHidden = true; mChatboxInput = new TextBox(mChatboxWindow, "ChatboxInputField"); mChatboxInput.SubmitPressed += ChatBoxInput_SubmitPressed; mChatboxInput.Text = GetDefaultInputText(); mChatboxInput.Clicked += ChatBoxInput_Clicked; mChatboxInput.IsTabable = false; mChatboxInput.SetMaxLength(Options.MaxChatLength); Interface.FocusElements.Add(mChatboxInput); mChannelLabel = new Label(mChatboxWindow, "ChannelLabel"); mChannelLabel.Text = Strings.Chatbox.channel; mChannelLabel.IsHidden = true; mChannelCombobox = new ComboBox(mChatboxWindow, "ChatChannelCombobox"); for (var i = 0; i < 3; i++) { var menuItem = mChannelCombobox.AddItem(Strings.Chatbox.channels[i]); menuItem.UserData = i; menuItem.Selected += MenuItem_Selected; } //Add admin channel only if power > 0. if (Globals.Me.Type > 0) { var menuItem = mChannelCombobox.AddItem(Strings.Chatbox.channeladmin); menuItem.UserData = 3; menuItem.Selected += MenuItem_Selected; } mChatboxText = new Label(mChatboxWindow); mChatboxText.Name = "ChatboxText"; mChatboxText.Font = mChatboxWindow.Parent.Skin.DefaultFont; mChatboxSendButton = new Button(mChatboxWindow, "ChatboxSendButton"); mChatboxSendButton.Text = Strings.Chatbox.send; mChatboxSendButton.Clicked += ChatBoxSendBtn_Clicked; mChatboxWindow.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString()); mChatboxText.IsHidden = true; // Disable this to start, since this is the default tab we open the client on. mTabButtons[ChatboxTab.All].Disable(); // Platform check, are we capable of copy/pasting on this machine? if (GameClipboard.Instance == null || !GameClipboard.Instance.CanCopyPaste()) { ChatboxMsg.AddMessage(new ChatboxMsg(Strings.Chatbox.UnableToCopy, CustomColors.Alerts.Error, ChatMessageType.Error)); } }
public CommonFactory(RenderTarget RenderTarget2D, GameInterface GameInterface) { this.RenderTarget2D = RenderTarget2D; this.GameInterface = GameInterface; }
public void LogMessage(string source, string message, LogLevel level) => GameInterface.Print($"[{source}] {message}\n");
public void OpenExportOps() { List <KeyValuePair <string, UnityAction> > exportOptions = new List <KeyValuePair <string, UnityAction> >(); GameInterface GI = GameInterface.instance; GameInfo gData = GameController.CurGameData; //add export options now... //JSON basic "all troops together" export! exportOptions.Add(new KeyValuePair <string, UnityAction>("Basic Export to JSON (all troops in a simple list - don't use if both sides use the same troop type)", () => { SerializableTroopListObj exportedList = new SerializableTroopListObj(JsonHandlingUtils.TroopListToSerializableTroopList (GameController.GetCombinedTroopsFromTwoLists (battlePhase.battleData.attackerSideInfo.sideArmy, battlePhase.battleData.defenderSideInfo.sideArmy))); string JSONContent = JsonUtility.ToJson(exportedList); Debug.Log(JSONContent); GI.textInputPanel.SetPanelInfo("JSON Export Result", "", JSONContent, "Copy to Clipboard", () => { GameInterface.CopyToClipboard(GI.textInputPanel.theInputField.text); }); GI.textInputPanel.Open(); GI.exportOpsPanel.gameObject.SetActive(false); })); //JSON basic "all troops together" export, splitting entries if troop amounts go above a certain limit! exportOptions.Add(new KeyValuePair <string, UnityAction>("Basic Export to JSON, splitting large troop entries - don't use if both sides use the same troop type", () => { GI.exportOpsPanel.gameObject.SetActive(false); GI.customInputPanel.Open(); NumericInputFieldBtns numBtns = GI.customInputPanel.AddNumericInput("Split Limit", true, gData.lastEnteredExportTroopSplitAmt, 0, 9999, 5, "Troop entries with more than this amount of troops will be divided in more than one JSON entry"); GI.customInputPanel.SetPanelInfo("Set Troop Entry Split Limit...", "Confirm", () => { int splitLimit = int.Parse(numBtns.targetField.text); gData.lastEnteredExportTroopSplitAmt = splitLimit; SerializableTroopListObj exportedList = new SerializableTroopListObj(JsonHandlingUtils.TroopListToSerializableTroopList (GameController.GetCombinedTroopsFromTwoLists (battlePhase.battleData.attackerSideInfo.sideArmy, battlePhase.battleData.defenderSideInfo.sideArmy), splitLimit)); string JSONContent = JsonUtility.ToJson(exportedList); Debug.Log(JSONContent); GI.textInputPanel.SetPanelInfo("JSON Export Result", "", JSONContent, "Copy to Clipboard", () => { GameInterface.CopyToClipboard(GI.textInputPanel.theInputField.text); }); GI.customInputPanel.Close(); GI.textInputPanel.Open(); }); })); //JSON export separating attackers from defenders with a user-defined "variable" AND splitting entries if troop amounts go above a certain limit! exportOptions.Add(new KeyValuePair <string, UnityAction>("Export to JSON, splitting large troop entries and adding a different variable to attackers and defenders", () => { GI.exportOpsPanel.gameObject.SetActive(false); string JSONContent = "{ \"troops\":["; GI.customInputPanel.Open(); NumericInputFieldBtns numBtns = GI.customInputPanel.AddNumericInput("Split Limit", true, gData.lastEnteredExportTroopSplitAmt, 0, 9999, 5, "Troop entries with more than this amount of troops will be divided in more than one JSON entry"); InputField addedVarName = GI.customInputPanel.AddTextInput("Added Variable Name", gData.lastEnteredExportAddedVariable, "The name of the variable that will be added to all entries"); InputField varForAttackers = GI.customInputPanel.AddTextInput("Value for Attackers", gData.lastEnteredExportAttackerVariable, "The value of the added variable for all entries of the attacker army. Add quotes if necessary"); InputField varForDefenders = GI.customInputPanel.AddTextInput("Value for Defenders", gData.lastEnteredExportDefenderVariable, "The value of the added variable for all entries of the defender army. Add quotes if necessary"); GI.customInputPanel.SetPanelInfo("Set Options...", "Confirm", () => { int splitLimit = int.Parse(numBtns.targetField.text); gData.lastEnteredExportTroopSplitAmt = splitLimit; gData.lastEnteredExportAddedVariable = addedVarName.text; gData.lastEnteredExportAttackerVariable = varForAttackers.text; gData.lastEnteredExportDefenderVariable = varForDefenders.text; List <SerializedTroop> sTroopList = JsonHandlingUtils.TroopListToSerializableTroopList(battlePhase.battleData.attackerSideInfo.sideArmy, splitLimit); for (int i = 0; i < sTroopList.Count; i++) { JSONContent = string.Concat(JSONContent, JsonHandlingUtils.ToJsonWithExtraVariable(sTroopList[i], addedVarName.text, varForAttackers.text), ","); } sTroopList = JsonHandlingUtils.TroopListToSerializableTroopList(battlePhase.battleData.defenderSideInfo.sideArmy, splitLimit); for (int i = 0; i < sTroopList.Count; i++) { JSONContent = string.Concat(JSONContent, JsonHandlingUtils.ToJsonWithExtraVariable(sTroopList[i], addedVarName.text, varForDefenders.text), i < sTroopList.Count - 1 ? "," : ""); } JSONContent += "]}"; Debug.Log(JSONContent); GI.textInputPanel.SetPanelInfo("JSON Export Result", "", JSONContent, "Copy to Clipboard", () => { GameInterface.CopyToClipboard(GI.textInputPanel.theInputField.text); }); GI.customInputPanel.Close(); GI.textInputPanel.Open(); }); })); //when done preparing options, open the export ops panel GI.exportOpsPanel.Open("Remaining Armies: Export Options", exportOptions); }
protected override void LoadContent() { GlobalsVar.Camera = new Camera(SceneManager.GraphicsDevice.Viewport); gameBackground = new Background(SceneManager.GraphicsDevice); gameBackground.LoadContent(SceneManager.Game.Content); gameInterface = new GameInterface(SceneManager.GraphicsDevice); gameInterface.Load(SceneManager.Game.Content); popMobTimer = new TimeSpan(0, 0, 3); lastPopMobTimer = new TimeSpan(popMobTimer.Hours, popMobTimer.Minutes, popMobTimer.Seconds); GlobalsVar.PlayerLife = 10; GlobalsVar.Map = new Map(); GlobalsVar.MeshModels.Add("testchar", SceneManager.Game.Content.Load<Model>(@"Models\p1_wedge")); GlobalsVar.MeshModels.Add("grassGround", SceneManager.Game.Content.Load<Model>(@"Models\GrassSquare")); GlobalsVar.MeshModels.Add("totem", SceneManager.Game.Content.Load<Model>(@"Models\totem-1")); GlobalsVar.MeshModels.Add("fireTower", SceneManager.Game.Content.Load<Model>(@"Models\fire_tower")); GlobalsVar.MeshModels.Add("waterTower", SceneManager.Game.Content.Load<Model>(@"Models\water_tower")); GlobalsVar.MeshModels.Add("earthTower", SceneManager.Game.Content.Load<Model>(@"Models\earth_tower")); GlobalsVar.MeshModels.Add("ponyStark", SceneManager.Game.Content.Load<Model>(@"Models\pony_stark")); GlobalsVar.MeshModels.Add("hq", SceneManager.Game.Content.Load<Model>(@"Models\qg")); GlobalsVar.MeshModels.Add("mob1", SceneManager.Game.Content.Load<Model>(@"Models\mob-1")); GlobalsVar.Map.Generate(10, 10, "grass"); towers = new List<Tower>(); target = new Target(new Vector3(8 * 4, 2 * 4, 0)); //GlobalsVar.Mobs.Add(new PonyStarkMob(new Vector3(0, 2*5, 0))); }