public Player(IGamePlayer player, int id, BaseGame game, int team) : base(id, game, team, "", "", 1000, 0, 1) //TODO lastPatemer direction { m_rect = new Rectangle(-15, -20, 30, 30); m_player = player; m_player.GamePlayerId = id; m_isActive = true; m_canGetProp = true; Grade = player.PlayerCharacter.Grade; TotalAllHurt = 0; TotalAllHitTargetCount = 0; TotalAllShootCount = 0; TotalAllKill = 0; TotalAllExperience = 0; TotalAllScore = 0; TotalAllCure = 0; m_weapon = m_player.MainWeapon; if (m_weapon != null) { var ballConfig = BallConfigMgr.FindBall(m_weapon.TemplateID); m_mainBallId = ballConfig.Common; m_spBallId = ballConfig.Special; //m_mainBallId = m_weapon.Property1; //m_spBallId = m_weapon.Property2; } m_loadingProcess = 0; InitBuffer(m_player.EquipEffect); m_energy = (m_player.PlayerCharacter.Agility / 30 + 240); m_maxBlood = (int)((950 + m_player.PlayerCharacter.Grade * 50 + LevelPlusBlood + m_player.PlayerCharacter.Defence / 10) * m_player.GetBaseBlood()); }
public void Execute(BaseGame game, Player player, ItemTemplateInfo item) { if (player.IsLiving) { new SealEffect(item.Property3, 1).Start(player); } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game.GameState != eGameState.Playing || player.GetSealState()) return; int type = packet.ReadByte(); int place = packet.ReadInt(); int templateID = packet.ReadInt(); ItemTemplateInfo template = ItemMgr.FindItemTemplate(templateID); if (player.CanUseItem(template)) { //if (player.CurrentBall.ID == 3 && template.TemplateID == 10003) // return; //if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving)) //{ // if (player.UseItem(template) == false) // { // BaseGame.log.Error("Using prop error"); // } //} if (player.PlayerDetail.UsePropItem(game, type, place, templateID, player.IsLiving)) { if (player.UseItem(template) == false) { BaseGame.log.Error("Using prop error"); } } else { player.UseItem(template); } } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { player.UseSpecialSkill(); } }
public Window(Control parent, BaseGame game) : base(parent, game) { _backColor = Color.Black; BackColor = Color.Transparent; ForeColor = Color.White; }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.HasPaymentTakeCard == false) { if (player.PlayerDetail.RemoveMoney(100) > 0&&player.PlayerDetail.RemoveGiftToken(429)>0) { int index = packet.ReadByte(); player.CanTakeOut += 1; player.FinishTakeCard = false; player.HasPaymentTakeCard = true; player.PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_PaymentTakeCard, player.PlayerDetail.PlayerCharacter.ID, 100, player.PlayerDetail.PlayerCharacter.Money); if (index < 0 || index > game.Cards.Length) { game.TakeCard(player); } else { game.TakeCard(player, index); } } else { player.PlayerDetail.SendInsufficientMoney((int)eBattleRemoveMoneyType.PaymentTakeCard); } } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if(game is PVEGame) { PVEGame pve = game as PVEGame; int tryAgain = packet.ReadInt(); bool isHost = packet.ReadBoolean(); if (isHost == true) { if (tryAgain == 1) { if (player.PlayerDetail.RemoveMoney(100) > 0) { //退回关卡结算 pve.WantTryAgain = 1; game.SendToAll(packet); player.PlayerDetail.LogAddMoney(AddMoneyType.Game, AddMoneyType.Game_TryAgain, player.PlayerDetail.PlayerCharacter.ID, 100, player.PlayerDetail.PlayerCharacter.Money); } else { player.PlayerDetail.SendInsufficientMoney((int)eBattleRemoveMoneyType.TryAgain); } } else { //退回房间 pve.WantTryAgain = 0; game.SendToAll(packet); } pve.CheckState(0); } } }
public Label(Control parent, BaseGame game) : base(parent, game) { Text = string.Empty; Font = new Font(this); }
public SimpleNpc(int id, BaseGame game, NpcInfo npcInfo, int type) : base(id, game, npcInfo.Camp, npcInfo.Name, npcInfo.ModelID, npcInfo.Blood, npcInfo.Immunity, -1) { if (type == 0) { Type = eLivingType.SimpleNpc; } else { Type = eLivingType.SimpleNpc1; } m_npcInfo = npcInfo; m_ai = ScriptMgr.CreateInstance(npcInfo.Script) as ABrain; if (m_ai == null) { log.ErrorFormat("Can't create abrain :{0}", npcInfo.Script); m_ai = SimpleBrain.Simple; } m_ai.Game = m_game; m_ai.Body = this; try { m_ai.OnCreated(); } catch (Exception ex) { log.ErrorFormat("SimpleNpc Created error:{1}", ex); } }
protected override void ExecuteImp(BaseGame game, long tick) { if (!m_isSent) { m_isSent = true; game.SendLivingFall(m_living, m_toX, m_toY, m_fallSpeed, m_action, m_type); } if (m_toY > m_living.Y + m_fallSpeed) { m_living.SetXY(m_toX, m_living.Y + m_fallSpeed); } else { m_living.SetXY(m_toX, m_toY); if (game.Map.IsOutMap(m_toX, m_toY)) { m_living.SyncAtTime = false; m_living.Die(); Console.WriteLine("掉落Fall" + m_living.IsLiving.ToString()); } if (m_callback != null) { //m_living.RunLuaFunction(m_callback); m_living.CallFuction(m_callback, 0); } Finish(tick); } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game is PVEGame) { PVEGame pve = game as PVEGame; if (pve.BossCardCount + 1 > 0) { int index = packet.ReadByte(); if (index < 0 || index > pve.BossCards.Length) { if (pve.IsBossWar != "") { pve.TakeBossCard(player); } else pve.TakeCard(player); } else { if (pve.IsBossWar != "") { pve.TakeBossCard(player, index); } else pve.TakeCard(player, index); } } } }
protected override void ExecuteImp(BaseGame game, long tick) { if (!m_isSent) { m_isSent = true; game.SendLivingMoveTo(m_living, m_living.X, m_living.Y, m_path[m_path.Count - 1].X, m_path[m_path.Count - 1].Y, m_action, m_speed); } m_index++; if (m_index >= m_path.Count) { if (m_path[m_index - 1].X > m_living.X) { m_living.Direction = 1; } else { m_living.Direction = -1; } m_living.SetXY(m_path[m_index - 1].X, m_path[m_index - 1].Y); if (m_callback != null) { m_living.CallFuction(m_callback, 0); } Finish(tick); } }
protected override void ExecuteImp(BaseGame game, long tick) { m_obj.CurrentAction = m_action; game.SendPhysicalObjPlayAction(m_obj); Finish(tick); }
protected override void ExecuteImp(BaseGame game, long tick) { GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, m_living.Id); pkg.Parameter1 = m_living.Id; pkg.WriteByte((byte)eTankCmdType.LIVING_RANGEATTACKING); List<Living> playersAround = game.Map.FindPlayers(m_fx, m_tx, m_players); int count = playersAround.Count; foreach (Living p in playersAround) { if (m_living.IsFriendly(p) == true) count--; } pkg.WriteInt(count); m_living.SyncAtTime = false; try { foreach (Living p in playersAround) { p.SyncAtTime = false; if (m_living.IsFriendly(p) == true) continue; int dander = 0; p.IsFrost = false; game.SendGameUpdateFrozenState(p); int damage = MakeDamage(p); int critical = MakeCriticalDamage(p, damage); int totalDemageAmount = 0; if (p.TakeDamage(m_living, ref damage, ref critical, "范围攻击")) { totalDemageAmount = damage + critical; if (p is Player) { Player player = p as Player; dander = player.Dander; } } pkg.WriteInt(p.Id); pkg.WriteInt(totalDemageAmount); pkg.WriteInt(p.Blood); //同步怒气值 pkg.WriteInt(dander); //attackEffect pkg.WriteInt(new Random().Next(2)); } game.SendToAll(pkg); Finish(tick); } finally { m_living.SyncAtTime = true; foreach (Living p in playersAround) { p.SyncAtTime = true; } } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { player.Skip(packet.ReadByte()); } }
public void Execute(BaseGame game, Player player, ItemTemplateInfo item) { switch (item.Property2) { case 0: if (player.IsLiving) { player.AddBlood(item.Property3); } break; case 1: List<Player> temps = player.Game.GetAllFightPlayers(); foreach (Player p in temps) { if (p.IsLiving && p.Team == player.Team) { p.AddBlood(item.Property3); } } break; default: break; } }
public void Execute(BaseGame game, long tick) { if(m_tick <= tick && m_finishTick == long.MaxValue) { ExecuteImp(game, tick); } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsLiving == false) { player.TargetPoint.X = packet.ReadInt(); player.TargetPoint.Y = packet.ReadInt(); } }
public PlayerScreen(Control parent, BaseGame game) : base(parent, game) { Name = "scnPlayer"; _game = game; //InitializeComponents(); }
public FPSCounter(BaseGame setGame, string fontName) : base(setGame) { font = setGame.Content.Load<SpriteFont>(fontName); int W = setGame.GraphicsDevice.Viewport.Width; int H = setGame.GraphicsDevice.Viewport.Height; fps = new StringToDraw(setGame, "FPS=", new Vector2((W - 100.0f) / (float)W, 5.0f / (float)H), font); }
protected override void ExecuteImp(BaseGame game, long tick) { Finish(tick); if (game.TurnIndex == m_turnIndex && m_living.IsAttacking) { m_living.StopAttacking(); game.CheckState(0); } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game.GameState != eGameState.Playing || player.GetSealState()) return; int killID = packet.ReadInt(); //game.SendPetUseKill(player, killID, true); player.PetUseKill(killID); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { player.UseSpecialSkill(); player.CurrentShootMinus *= (float)player.CurrentBall.Power; } }
public StringToDraw(BaseGame setGame, string txt, Vector2 pos, SpriteFont setFont) : base(setGame) { text = txt; position = pos; font = setFont; color = Color.YellowGreen; game = setGame; }
protected override void ExecuteImp(BaseGame game, long tick) { SealEffect effect = (SealEffect)m_Target.EffectList.GetOfType(eEffectType.SealEffect); if (effect != null) { effect.Stop(); } base.Finish(tick); }
protected override void ExecuteImp(BaseGame game, long tick) { if (m_living is SimpleBoss) { m_living.GetShootForceAndAngle(ref m_tx, ref m_ty, m_bombId, m_minTime, m_maxTime, m_bombCount, m_Time, ref m_force, ref m_angle); } m_living.ShootImp(m_bombId,m_tx,m_ty, m_force, m_angle, m_bombCount, 0); Finish(tick); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsLiving && game.GameState == eGameState.Playing) { game.SendToAll(packet); player.Die(); game.CheckState(0); } }
protected override void ExecuteImp(BaseGame game, long tick) { try { m_func(); } finally { Finish(tick); } }
public static void ExecuteSpell(BaseGame game,Player player,ItemTemplateInfo item) { try { ISpellHandler spellHandler = SpellMgr.LoadSpellHandler(item.Property1); spellHandler.Execute(game, player, item); } catch (Exception ex) { log.Error("Execute Spell Error:", ex); } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game.GameState == eGameState.Loading) { player.LoadingProcess = packet.ReadInt(); if (player.LoadingProcess >= 100) { game.CheckState(0); } game.SendToAll(packet); } }
/// <summary> /// Get the text width of a given text. /// </summary> /// <param name="text">Text</param> /// <returns>Width (in pixels) of the text</returns> public static int GetTextWidth(string text) { int width = 0; //foreach (char c in text) char[] chars = text.ToCharArray(); for (int num = 0; num < chars.Length; num++) { int charNum = (int)chars[num]; if (charNum >= 32 && charNum - 32 < CharRects.Length) { width += BaseGame.XToRes1400(CharRects[charNum - 32].Height); } } return(width); }
} // Render() #endregion #region Unit Testing #if DEBUG #region TestRenderLines /// <summary> /// Test render lines /// </summary> public static void TestRenderLines() { TestGame.Start( delegate // 3d render code { for (int num = 0; num < 200; num++) { BaseGame.DrawLine( new Vector3(-12.0f + num / 4.0f, 13.0f, 0), new Vector3(-17.0f + num / 4.0f, -13.0f, 0), new Color((byte)(255 - num), 14, (byte)num)); } // for TextureFont.WriteText(2, 30, "cam pos=" + BaseGame.CameraPos); }); } // TestRenderLines()
public override void Load(BaseGame game) { base.Load(game); Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) }, modeButtons = new FlowContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Direction = FlowDirection.HorizontalOnly, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, modeButtonLine = new Box { RelativeSizeAxes = Axes.X, Size = new Vector2(0.3f, 3), Anchor = Anchor.BottomLeft, Origin = Anchor.TopCentre, Colour = Color4.White } }; foreach (PlayMode m in Enum.GetValues(typeof(PlayMode))) { var localMode = m; modeButtons.Add(new ToolbarModeButton { Mode = m, Action = delegate { SetGameMode(localMode); OnPlayModeChange?.Invoke(localMode); } }); } RelativeSizeAxes = Axes.Y; Size = new Vector2(modeButtons.Children.Count() * ToolbarButton.WIDTH + padding * 2, 1); }
public SpaceshipPlayers(BaseGame i_Game, GameScreen i_BaseScreen) : base(i_Game) { m_SpaceshipPlayers = new List <SpaceshipPlayer>(); m_GameScreen = i_BaseScreen; m_Game = i_Game; this.m_PlayerManager = Game.Services.GetService(typeof(IPlayersManager)) as IPlayersManager; m_NumOfPlayers = 1; this.createSpaceshipPlayers(i_BaseScreen, i_Game); if (m_Accelerometer == null) { m_Accelerometer = new Accelerometer(); m_Accelerometer.CurrentValueChanged += accelSensor_CurrentValueChanged; m_Accelerometer.Start(); } }
public MarcoPolo(BaseGame game, IGState previous, Color c) : base(game, previous) { DragFrom = Vector2.Zero; Game.BackGroundTune.SetVolume(0f); woosh = new Tween(new TimeSpan(0, 0, 0, 5), 0, 1); Game.Audio.Say(Message); Message = "Let's go"; game.ParticleColor = (c == Color.Black) ? Color.White : Color.Black; Color = c; Location = new Vector2(-10, -10); Tap = Location; Timer = new Tween(new TimeSpan(0, 0, 0, (Message == "Let's go")?3:10), 0, 1); Wait = new Tween(new TimeSpan(0, 0, 0, 1), 0, 1); Marco = true; TapTimer = new Tween(new TimeSpan(0, 0, 0, 5), 0, 1); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game.GameState == eGameState.SessionPrepared || game.GameState == eGameState.GameOver) { //if (player.Weapon == null) //{ // player.PlayerDetail.SendMessage(LanguageMgr.GetTranslation("Game.Server.SceneGames.NoEquip")); // return; //} bool isReady = packet.ReadBoolean(); if (isReady == true) { player.Ready = true; game.CheckState(0); } } }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (game.GameState == eGameState.Loading) { player.LoadingProcess = packet.ReadInt(); if (player.LoadingProcess >= 100) { game.CheckState(0); } GSPacketIn gSPacketIn = new GSPacketIn(91); gSPacketIn.WriteByte(16); gSPacketIn.WriteInt(player.LoadingProcess); gSPacketIn.WriteInt(4); gSPacketIn.WriteInt(player.PlayerDetail.PlayerCharacter.ID); game.SendToAll(gSPacketIn); } }
public void Execute(BaseGame game, long tick) { if (m_tick <= tick) { PVPGame pvp = game as PVPGame; if (pvp != null) { switch (game.GameState) { case eGameState.Inited: pvp.Prepare(); break; case eGameState.Prepared: pvp.StartLoading(); break; case eGameState.Loading: if (pvp.IsAllComplete()) { pvp.StartGame(); } break; case eGameState.Playing: if (pvp.CurrentPlayer == null || pvp.CurrentPlayer.IsAttacking == false) { if (pvp.CanGameOver()) { pvp.GameOver(); } else { pvp.NextTurn(); } } break; case eGameState.GameOver: pvp.Stop(); break; } } m_isFinished = true; } }
public override void Draw(GameTime gameTime, BaseGame game) { SpriteBatch.Begin(); SpriteBatch.Draw(BaseGame.Pixel, Game.Bounds, Color); SpriteBatch.Draw(BaseGame.Pixel, new Rectangle(0, 0, (int)(Width / 2f), (int)(Height / 3f)), ((Color == Color.Black)?Color.White:Color.Black) * Top); SpriteBatch.Draw(BaseGame.Pixel, new Rectangle(0, (int)(Height / 3f), (int)(Width / 2f), (int)(Height / 3f)), ((Color == Color.Black) ? Color.White : Color.Black) * Middle); SpriteBatch.Draw(BaseGame.Pixel, new Rectangle(0, (int)((Height / 3f) * 2f), (int)(Width / 2f), (int)(Height / 3f)), ((Color == Color.Black) ? Color.White : Color.Black) * Bottom); SpriteBatch.Draw(BaseGame.Pixel, new Rectangle((int)(Width / 2f), 0, (int)(Width / 2f), (int)(Height / 3f)), ((Color == Color.Black) ? Color.White : Color.Black) * CTop); SpriteBatch.Draw(BaseGame.Pixel, new Rectangle((int)(Width / 2f), (int)(Height / 3f), (int)(Width / 2f), (int)(Height / 3f)), ((Color == Color.Black) ? Color.White : Color.Black) * CMiddle); SpriteBatch.Draw(BaseGame.Pixel, new Rectangle((int)(Width / 2f), (int)((Height / 3f) * 2f), (int)(Width / 2f), (int)(Height / 3f)), ((Color == Color.Black) ? Color.White : Color.Black) * CBottom); SpriteBatch.End(); }
public WelcomeScreen(BaseGame i_Game) : base(i_Game) { m_Game = i_Game; Background background = new Background(i_Game, this, 1); m_WelcomeMessage = new GameText2D(i_Game, this, @"Fonts\Showcard Gothic"); m_EnterToplay = new GameText2D(i_Game, this, @"Fonts\Jokerman"); m_HToMainMenu = new GameText2D(i_Game, this, @"Fonts\Jokerman"); m_EscToExit = new GameText2D(i_Game, this, @"Fonts\Jokerman"); this.UseFadeTransition = false; this.BlendState = Microsoft.Xna.Framework.Graphics.BlendState.NonPremultiplied; }
public void Execute(BaseGame game, Player player, ItemTemplateInfo item) { if (player.IsSpecialSkill) { return; } if ((player.CurrentBall.ID == 3 || player.CurrentBall.ID == 5 || player.CurrentBall.ID == 1) && item.TemplateID == 10003) { player.BallCount = 1; } else { player.CurrentDamagePlus *= 0.5f; player.BallCount = item.Property2; } }
protected override void Load(BaseGame game) { base.Load(game); config = new TestBrowserConfig(game.Host.Storage); Add(leftContainer = new Container { RelativeSizeAxes = Axes.Y, Size = new Vector2(200, 1) }); leftContainer.Add(new Box { Colour = Color4.DimGray, RelativeSizeAxes = Axes.Both }); leftContainer.Add(leftScrollContainer = new ScrollContainer { ScrollbarOverlapsContent = false }); leftScrollContainer.Add(leftFlowContainer = new FlowContainer { Padding = new MarginPadding(3), Direction = FlowDirection.VerticalOnly, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Spacing = new Vector2(0, 5) }); //this is where the actual tests are loaded. Add(testContainer = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 200 } }); tests.Sort((a, b) => a.DisplayOrder.CompareTo(b.DisplayOrder)); foreach (var testCase in tests) { addTest(testCase); } }
public SimpleBomb(int id, BombType type, Living owner, BaseGame game, BallInfo info, Tile shape, bool controled) : base(id, info.Mass, info.Weight, info.Wind, info.DragIndex) { m_owner = owner; m_game = game; m_info = info; m_shape = shape; m_type = type; m_power = info.Power; m_radius = info.Radii; m_controled = controled; m_bombed = false; m_lifeTime = 0; digMap = true; }
public UnifiedInput(BaseGame game) { Game = game; TapListeners = new List <Procedure <Vector2> >(); MoveListeners = new List <Procedure <Vector2> >(); DraggingListeners = new List <Operation <Vector2> >(); DraggedListeners = new List <Operation <Vector2> >(); Game.Mouse.LeftClickListeners.Add(Tap); Game.Mouse.MoveListeners.Add(Move); Game.Mouse.DraggedListeners.Add(Dragged); Game.Mouse.DraggingListeners.Add(Dragging); Game.Touch.TapListeners.Add(Tap); Game.Touch.MoveListeners.Add(Move); Game.Touch.DraggedListeners.Add(Dragged); Game.Touch.DraggingListeners.Add(Dragging); }
public override IBaseGameComponent CreateComponent(BaseGame game, IBaseGameComponentContainer parent) { var config = game.ConfigurationStore.Get <DebugOverlayConfig>(); if (config.Data.Visible) { Trace.Assert(parent is IVisualContainer); var debug = new DebugOverlay(game, (IVisualContainer)parent); debug.FillColor = config.Data.TextFill; debug.FontSize = config.Data.FontSize; return(debug); } else { return(null); } }
public Menu(BaseGame game, Procedure <MenuItem> selectEvent, MenuItem item, params MenuItem[] items) { item.Selected = true; foreach (var menuItem in items) { menuItem.Selected = false; } var i = new List <MenuItem> { item }; i.AddRange(items); _items = i.ToArray(); _game = game; _selectEvent = selectEvent; _taps = new List <Vector2>(); UnifiedInput.TapListeners.Add(Tap); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { int x = packet.ReadInt(); int y = packet.ReadInt(); //检查开炮点的距离有效性 if (player.CheckShootPoint(x, y) == false) { return; } int force = packet.ReadInt(); int angle = packet.ReadInt(); player.Shoot(x, y, force, angle); } }
private void HandleSysNotice(GSPacketIn pkg) { BaseGame game = GameMgr.FindGame(pkg.ClientID); if (game != null) { Player player = game.FindPlayer(pkg.Parameter1); GSPacketIn pkg1 = new GSPacketIn((byte)eFightPackageType.SYS_NOTICE); // int type = pkg.ReadInt(); pkg1.WriteInt(3); pkg1.WriteString(LanguageMgr.GetTranslation("AbstractPacketLib.SendGamePlayerLeave.Msg6", player.PlayerDetail.PlayerCharacter.Grade * 12, 15)); player.PlayerDetail.SendTCP(pkg1); pkg1.ClearContext(); pkg1.WriteInt(3); pkg1.WriteString(LanguageMgr.GetTranslation("AbstractPacketLib.SendGamePlayerLeave.Msg7", player.PlayerDetail.PlayerCharacter.NickName, player.PlayerDetail.PlayerCharacter.Grade * 12, 15)); game.SendToAll(pkg1, player.PlayerDetail); } }
private void HandleSendToGameAllPlayer(GSPacketIn pkg) { BaseGame game = GameMgr.FindGame(pkg.ClientID); if (game != null) { GSPacketIn content = pkg.ReadPacket(); Player except = game.FindPlayer(pkg.Parameter1); if (except != null) { game.SendToAll(content, except.PlayerDetail); } else { game.SendToAll(content); } } }
public GridMenuItem(BaseGame game, Rectangle bounds, Getter <int> get, Setter <int> set, string name) : base(game, bounds, name) { _colorA = new Color((float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble()); _colorB = new Color((float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble()); _colorC = new Color((float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble()); _colorD = new Color((float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble(), (float)BaseGame.Random.NextDouble()); _rcolor = new Tween(new TimeSpan(0, 0, 0, 2), 0, 1); var mx = Textures.Back.Width; var my = Textures.Back.Height; var xs = (float)Math.Min(my, Bounds.Height) / Math.Max(my, Bounds.Height); Bounds = new Rectangle(bounds.X, bounds.Y, (int)(bounds.Width + ((mx * xs) * 2)), bounds.Height); _rightRegion = new Rectangle((int)(bounds.X + bounds.Width + (mx * xs)), bounds.Y, (int)(mx * xs), bounds.Height); _leftRegion = new Rectangle(bounds.X, bounds.Y, (int)(mx * xs), bounds.Height); _get = get; _set = set; }
public override void Add(Drawable drawable) { Debug.Assert(!Children.Any(), @"Don't load more than one Game in a Host"); BaseGame game = drawable as BaseGame; Debug.Assert(game != null, @"Make sure to load a Game in a Host"); Dependencies.Cache(game); game.SetHost(this); if (!IsLoaded) { PerformLoad(game); } LoadGame(game); }
private void HandlePlayerUsingProp(GSPacketIn pkg) { BaseGame game = GameMgr.FindGame(pkg.ClientID); if (game != null) { game.Resume(); if (pkg.ReadBoolean()) { Player player = game.FindPlayer(pkg.Parameter1); ItemTemplateInfo template = ItemMgr.FindItemTemplate(pkg.Parameter2); if (player != null && template != null) { player.UseItem(template); } } } }
public override void Load(BaseGame game) { base.Load(game); Depth = float.MaxValue; RelativeSizeAxes = Axes.Y; Size = new Vector2(width, 1); Position = new Vector2(-width, 0); Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f) } }; }
public override void Load(BaseGame game) { base.Load(game); Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); Add(new Sprite { Texture = game.Textures.Get(@"Menu/logo"), Origin = Anchor.Centre, Scale = new Vector2(0.2f), RelativePositionAxes = Axes.Both, Position = new Vector2(0.1f, 0.5f), Colour = Color4.Gray }); }
public override void Load(BaseGame game) { base.Load(game); tex = game.Textures.Get(@"Play/osu/triangle@2x"); for (int i = 0; i < 10; i++) { Add(new Sprite { Texture = tex, Origin = Anchor.Centre, Position = new Vector2(RNG.NextSingle() * DrawSize.X, RNG.NextSingle() * DrawSize.Y), Scale = new Vector2(RNG.NextSingle() * 0.4f + 0.2f), Alpha = RNG.NextSingle() * 0.3f, }); } }
public override void Draw(GameTime gameTime, BaseGame game) { SpriteBatch.Begin(); SpriteBatch.Draw(BaseGame.Pixel, Game.Bounds, Color); DrawLines(SpriteBatch, Width, Height, (Color == Color.Black) ? Color.White : Color.Black, new[] { "Main Menu", "Swipe Left or Right to select a game", "Tap the Screen to Play", "At any time during a game you can press", "ESC to return to the Main Menu", "After a game or turn you can swipe up to play again", "Or down to leave that game", "For Advice or Suggestions", "Contact [email protected]" }); SpriteBatch.End(); }
protected override void ExecuteImp(BaseGame game, long tick) { this.m_target.SyncAtTime = false; try { if (this.m_target.TakeDamage(this.m_living, ref this.m_demageAmount, ref this.m_criticalAmount, "LivingFire")) { int totalDemageAmount = this.m_demageAmount + this.m_criticalAmount; game.SendLivingBeat(this.m_living, this.m_target, totalDemageAmount, this.m_action, this.m_livingCount, this.m_attackEffect); } this.m_target.IsFrost = false; base.Finish(tick); } finally { this.m_target.SyncAtTime = true; } }
public override IComponent Update(GameTime gameTime, BaseGame game) { if (NextComponent != null) { return(NextComponent); } if (KeyboardInput.Any()) { _gmTween.Finish(); _gfTween.Finish(); _rfTween.Finish(); _rmTween.Finish(); _ifTween.Finish(); _imTween.Finish(); _dfTween.Finish(); _dmTween.Finish(); _sfTween.Finish(); } _gmTween.Update(gameTime.ElapsedGameTime); _gfTween.Update(gameTime.ElapsedGameTime); _sfTween.Update(gameTime.ElapsedGameTime); if (!(_gfTween > .5f)) { return(this); } _rmTween.Update(gameTime.ElapsedGameTime); _rfTween.Update(gameTime.ElapsedGameTime); if (!(_rfTween > .5f)) { return(this); } _imTween.Update(gameTime.ElapsedGameTime); _ifTween.Update(gameTime.ElapsedGameTime); if (_ifTween > .5f) { _dmTween.Update(gameTime.ElapsedGameTime); _dfTween.Update(gameTime.ElapsedGameTime); } if (_dfTween.IsComplete) { return(new MainMenu(Game, null)); } return(this); }
private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game, bool select = false) { beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.ID); beatmapSet.Beatmaps.ForEach(b => { database.GetChildren(b); if (b.Metadata == null) { b.Metadata = beatmapSet.Metadata; } }); beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList(); var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database); var group = new BeatmapGroup(beatmap, beatmapSet) { SelectionChanged = selectionChanged, StartRequested = b => start() }; //for the time being, let's completely load the difficulty panels in the background. //this likely won't scale so well, but allows us to completely async the loading flow. Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate { beatmapGroups.Add(group); carousel.AddGroup(group); if (Beatmap == null || select) { carousel.SelectBeatmap(beatmapSet.Beatmaps.First()); } else { var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo)); if (panel != null) { carousel.SelectGroup(group, panel); } } })); }
public void HandleCommand(BaseGame game, Player player, GSPacketIn packet) { if (player.IsAttacking) { packet.Parameter1 = player.Id; game.SendToAll(packet); //同客户端同步LifeTime game.SendSyncLifeTime(); bool tag = packet.ReadBoolean(); //开炮所需时间 if (tag) { byte speedTime = packet.ReadByte(); player.PrepareShoot(speedTime); } } }