public ShipController(ShipModel model, ShipView view) { _view = view; // Init Player Controls BindDirKeys(); Observable .EveryUpdate() .Where(_ => Input.GetMouseButtonDown(0) && !Utils.IsPointerOverGameObject()) .Subscribe(_ => model.Fire()) .AddTo(_disposables); // Bind View view.Direction = MergeDirKeys(); view.Speed = model.Speed.ToReadOnlyReactiveProperty(); // Bind Model { model.Position = Observable.EveryFixedUpdate() .Select(_ => view.Position) .ToReadOnlyReactiveProperty(); view.TriggerEnterEvents .Subscribe(_ => model.TakeDamage()); model.OnDestroyed += Destroy; } }
public ViewManager(ShipView shipView, CrashEffectView crashEffectView, IMoveViewModel moveViewModel, FuelView fuelView, EndGameMessageView endGameMessageView, StartButtonView startButtonView, ExitButtonView exitButtonView, TitleView titleView, IHitListener hitListener, IFuelViewModel fuelViewModel, IGameManager gameManager) { _shipView = shipView; _crashEffectView = crashEffectView; _moveViewModel = moveViewModel; _fuelView = fuelView; _endGameMessageView = endGameMessageView; _startButtonView = startButtonView; _exitButtonView = exitButtonView; _titleView = titleView; _fuelViewModel = fuelViewModel; _crashAssessmentViewModel = hitListener.CrashAssessment; _landingAssessmentViewModel = hitListener.LandingAssessment; _gameManager = gameManager; }
/////////////////////////////////////////////////////////// private IShip CreateShip() { var gameObject = new GameObject("Ship"); var model = new GameObject("Model"); model.AddComponent <SpriteRenderer>(); model.transform.parent = gameObject.transform; var shipModel = new ShipModel(5, 0, ""); var shipView = new ShipView(model); var speedConfigs = new MockSpeedConfigs(); speedConfigs.acceleration = 0; speedConfigs.startSpeed = 5; speedConfigs.maxSpeed = 15; var ship = gameObject.AddComponent <Ship>(); var movingComponent = new MovingComponent(ship, gameObject.transform, speedConfigs); ship.Construct(shipModel, shipView, movingComponent); return(ship); }
public ActionResult Create() { VShipRepository repo = new VShipRepository(); ViewBag.cust = Menu.Cust; ShipView vShip = repo.GetCreate(Menu.CustId); return(View(vShip)); }
public async Task <ActionResult> Create(ShipView vShip) { if (ModelState.IsValid) { VShipRepository repo = new VShipRepository(); return(RedirectToAction("Index")); } return(View(vShip)); }
public void ChangeSelectedShip(ShipView newship) { if (selectedShip != null) { selectedShip.OnUnselect(); selectedShip = null; } selectedShip = newship; }
public ActionResult NewAdres(Adres adres) { adres.CustId = Menu.CustId; db.Adreses.Add(adres); db.SaveChanges(); ShipView order = (ShipView)Session["Order"]; int sid = order.ShipViewId; return(RedirectToAction("Edit", "VShips", new { id = sid })); }
public ShipFactory(float speed) { View = GameObject.Instantiate( Refs.Instance.ShipViewPrefab, Refs.Instance.ShipSpawnPos.position, Refs.Instance.ShipViewPrefab.transform.rotation, Refs.Instance.Gameplay ); Model = new ShipModel(speed); Controller = new ShipController(Model, View); }
private void Awake() { shipView = gameObject.GetComponent <ShipView>(); shipModel = gameObject.GetComponent <ShipModel>(); shipModel.projectileSpawnPoints = new Transform[] { transform.GetChild(0), transform.GetChild(1), transform.GetChild(2) }; }
public void OnClic() { WindowSystem ws = FindObjectOfType <WindowSystem>(); PrefabManager pm = FindObjectOfType <PrefabManager>(); ShipView view = Instantiate(pm.prefabShipView); Window w = ws.NewWindow("ShipView", view.gameObject); view.SetShip(_ship); w.Show(); }
public async Task <ActionResult> Edit(int id) { VShipRepository repo = new VShipRepository(); ShipView vShip = repo.GetChange(id); Session["Detal"] = vShip.Detal; if (vShip == null) { return(HttpNotFound()); } return(View(vShip)); }
public ActionResult DeleteStatus(int id) { var ShipView = new ShipView(); using (CMS_modelContainer context = new CMS_modelContainer()) { ShipView = context.ShipViews.Where(b => b.Ship_Id == id).FirstOrDefault(); context.ShipViews.Remove(ShipView); context.SaveChanges(); } return(RedirectToAction("Index")); }
public Ship shippiar(ShipView shipView) { var ship = new Ship(); ship.Id = shipView.Id; ship.Type = shipView.Type; ship.Locations = new List <ShipLocation>(); foreach (ShipLocationView shipVLoc in shipView.Locations) { ShipLocation shipLoca = new ShipLocation(); shipLoca.Location = shipVLoc.Location; shipLoca.Id = shipVLoc.Id; ship.Locations.Add(shipLoca); } return(ship); }
public void OnUniverseObjectAdded(UniverseObject universeObject) { if (universeObject is UniverseEngine.Avatar) { avatarView = universeFactory.GetAvatar(); avatarView.Init((UniverseEngine.Avatar)universeObject, this); tilemapObjectViews.Add(avatarView); } else if (universeObject is UniverseEngine.Ship) { shipView = universeFactory.GetShip(); shipView.Init((UniverseEngine.Ship)universeObject, this); tilemapObjectViews.Add(shipView); } }
public ActionResult Add_New(ShipView svs) { using (CMS_modelContainer context = new CMS_modelContainer()) { var shipView = new ShipView(); shipView.Ship_Place = svs.Ship_Place; shipView.Ship_Depart = svs.Ship_Depart; shipView.Ship_Arrived = svs.Ship_Arrived; shipView.Status = "Pending"; context.ShipViews.Add(shipView); context.SaveChanges(); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit(ShipView vShip, string Adres, string Person) { List <ShipOrderDetailView> detal = (List <ShipOrderDetailView>)Session["Detal"]; VShipRepository repo = new VShipRepository(); Session["Order"] = vShip; repo.Save(vShip, detal); if (Adres == "Новый") { return(RedirectToAction("NewAdres")); } if (Person == "Новый") { return(RedirectToAction("NewPerson")); } return(RedirectToAction("Index")); }
public ActionResult EditStatus(int id) { var shipView = new ShipView(); EditShipViewModel esvm = new EditShipViewModel(); using (CMS_modelContainer context = new CMS_modelContainer()) { shipView = context.ShipViews.Where(b => b.Ship_Id == id).FirstOrDefault(); esvm.Ship_Id = shipView.Ship_Id; esvm.Ship_Place = shipView.Ship_Place; esvm.Ship_Depart = shipView.Ship_Depart; esvm.Ship_Arrived = shipView.Ship_Arrived; esvm.Status = shipView.Status; } esvm.listItem = new List <SelectListItem>(); loadList(esvm.listItem); return(View(esvm)); }
//Bootstrap game. public void Start() { _planetsPool = ObjectPool <PlanetView> .Construct( planetPrefab, configuration.MaximumObservablePlanets, go => go.GetComponent <PlanetView>() ); var(gameInstance, initialState) = GameFactory.Generate(configuration.GameConfiguration()); playerController.Init(gameInstance); var shipInstance = Instantiate(shipPrefab); gridCamera.Adjust(initialState.Zoom); _shipView = shipInstance.GetComponent <ShipView>(); _shipView.Init(initialState.PlayerRating); UpdateView(initialState); }
/// <summary> /// 列の自動調整設定を適用します。 /// </summary> /// <param name="flag">設定。nullなら既定値を、そうでなければその値を設定します。</param> private void SetColumnAutoSize(bool?flag = null) { if (flag == null) { flag = MenuMember_ColumnAutoSize.Checked; } else { MenuMember_ColumnAutoSize.Checked = (bool)flag; } if (flag == true) { ShipView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader); } foreach (DataGridViewColumn column in ShipView.Columns) { column.AutoSizeMode = flag == true ? DataGridViewAutoSizeColumnMode.AllCellsExceptHeader : DataGridViewAutoSizeColumnMode.NotSet; } }
public override void initOnScene(SceneNode parentNode, int tileCMVIndex, int compositeModelTilesNumber) { base.initOnScene(parentNode, tileCMVIndex, compositeModelTilesNumber); CompositeModelView cmv; int variant = ((IslandTile)LevelTile).Variant; switch (variant) { case 0: //Nic , haha break; case 1: //Lotniskowiec cmv = new CarrierView(tileCMVIndex, framework, parentNode); backgroundViews.Add(cmv); break; case 2: //2 wysepki cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_LAGUNA, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_ROUND, framework, parentNode); backgroundViews.Add(cmv); break; case 3: //3 wysepki cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_ROUND, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_ROUND, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_DLAGUNA, framework, parentNode); backgroundViews.Add(cmv); break; case 4: //Duza wyspa cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_6, framework, parentNode); backgroundViews.Add(cmv); break; case 5: //3 wysepki + lotniskowiec cmv = new CarrierView(this.LevelTile.TileIndex, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_DLAGUNA, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_ROUND, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_LAGUNA, framework, parentNode); cmv.MainNode.SetScale(2, 2, 2); backgroundViews.Add(cmv); break; case 6: //3 wysepki w tym laguna cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_ROUND, framework, parentNode); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_LAGUNA, framework, parentNode); cmv.MainNode.SetScale(2, 2, 2); backgroundViews.Add(cmv); cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_ISLAND_ROUND, framework, parentNode); backgroundViews.Add(cmv); break; case 7: // radar cmv = new BackGroundDummyIslandView(this.LevelTile.TileIndex, BackGroundDummyIslandView.C_DUMMY_RADAR_DOME, framework, parentNode); backgroundViews.Add(cmv); break; case 8: // okret podwodny cmv = new ShipView(TypeOfEnemyShip.Submarine, this.LevelTile.TileIndex, framework, parentNode); backgroundViews.Add(cmv); break; case 9: // patrolboat cmv = new ShipView(TypeOfEnemyShip.PatrolBoat, this.LevelTile.TileIndex, framework, parentNode); backgroundViews.Add(cmv); break; case 10: // warhsip cmv = new ShipView(TypeOfEnemyShip.WarShip, this.LevelTile.TileIndex, framework, parentNode); backgroundViews.Add(cmv); break; } }
/// <summary> /// ShipViewを更新します。 /// </summary> private void ChangeShipView(ImageLabel target) { if (target == null) { return; } int groupID = (int)target.Tag; var group = KCDatabase.Instance.ShipGroup[groupID]; ApplyGroupData(SelectedTab); if (group == null) { Utility.Logger.Add(3, "エラー:存在しないグループを参照しようとしました。開発者に連絡してください"); return; } if (group.GroupID < 0) { group.Members = group.Members.Intersect(KCDatabase.Instance.Ships.Keys).Union(KCDatabase.Instance.Ships.Keys).Distinct().ToList(); } ShipView.SuspendLayout(); ShipView.Rows.Clear(); IEnumerable <ShipData> ships = group.MembersInstance; List <DataGridViewRow> rows = new List <DataGridViewRow>(ships.Count()); foreach (ShipData ship in ships) { if (ship == null) { continue; } DataGridViewRow row = new DataGridViewRow(); row.CreateCells(ShipView); row.SetValues( ship.MasterID, ship.MasterShip.ShipType, ship.MasterShip.Name, ship.Level, ship.ExpTotal, ship.ExpNext, ship.ExpNextRemodel, new Fraction(ship.HPCurrent, ship.HPMax), ship.Condition, new Fraction(ship.Fuel, ship.MasterShip.Fuel), new Fraction(ship.Ammo, ship.MasterShip.Ammo), GetEquipmentString(ship, 0), GetEquipmentString(ship, 1), GetEquipmentString(ship, 2), GetEquipmentString(ship, 3), GetEquipmentString(ship, 4), ship.FleetWithIndex, ship.RepairingDockID == -1 ? ship.RepairTime : -1000 + ship.RepairingDockID, ship.FirepowerBase, ship.FirepowerRemain, ship.TorpedoBase, ship.TorpedoRemain, ship.AABase, ship.AARemain, ship.ArmorBase, ship.ArmorRemain, ship.ASWBase, ship.EvasionBase, ship.LOSBase, ship.LuckBase, ship.LuckRemain, ship.IsLocked, ship.SallyArea ); row.Cells[ShipView_Name.Index].Tag = ship.ShipID; row.Cells[ShipView_Level.Index].Tag = ship.ExpTotal; { DataGridViewCellStyle cs; double hprate = (double)ship.HPCurrent / Math.Max(ship.HPMax, 1); if (hprate <= 0.25) { cs = CSRedRight; } else if (hprate <= 0.50) { cs = CSOrangeRight; } else if (hprate <= 0.75) { cs = CSYellowRight; } else if (hprate < 1.00) { cs = CSGreenRight; } else { cs = CSDefaultRight; } row.Cells[ShipView_HP.Index].Style = cs; } { DataGridViewCellStyle cs; if (ship.Condition < 20) { cs = CSRedRight; } else if (ship.Condition < 30) { cs = CSOrangeRight; } else if (ship.Condition < Utility.Configuration.Config.Control.ConditionBorder) { cs = CSYellowRight; } else if (ship.Condition < 50) { cs = CSDefaultRight; } else { cs = CSGreenRight; } row.Cells[ShipView_Condition.Index].Style = cs; } row.Cells[ShipView_Fuel.Index].Style = ship.Fuel < ship.MasterShip.Fuel ? CSYellowRight : CSDefaultRight; row.Cells[ShipView_Ammo.Index].Style = ship.Fuel < ship.MasterShip.Fuel ? CSYellowRight : CSDefaultRight; { DataGridViewCellStyle cs; if (ship.RepairTime == 0) { cs = CSDefaultRight; } else if (ship.RepairTime < 1000 * 60 * 60) { cs = CSYellowRight; } else if (ship.RepairTime < 1000 * 60 * 60 * 6) { cs = CSOrangeRight; } else { cs = CSRedRight; } row.Cells[ShipView_RepairTime.Index].Style = cs; } row.Cells[ShipView_FirepowerRemain.Index].Style = ship.FirepowerRemain == 0 ? CSGrayRight : CSDefaultRight; row.Cells[ShipView_TorpedoRemain.Index].Style = ship.TorpedoRemain == 0 ? CSGrayRight : CSDefaultRight; row.Cells[ShipView_AARemain.Index].Style = ship.AARemain == 0 ? CSGrayRight : CSDefaultRight; row.Cells[ShipView_ArmorRemain.Index].Style = ship.ArmorRemain == 0 ? CSGrayRight : CSDefaultRight; row.Cells[ShipView_LuckRemain.Index].Style = ship.LuckRemain == 0 ? CSGrayRight : CSDefaultRight; row.Cells[ShipView_Locked.Index].Style = ship.IsLocked ? CSIsLocked : CSDefaultCenter; rows.Add(row); } for (int i = 0; i < rows.Count; i++) { rows[i].Tag = i; } ShipView.Rows.AddRange(rows.ToArray()); { int columnCount = ShipView.Columns.Count; if (group.ColumnFilter != null) { columnCount = Math.Min(columnCount, group.ColumnFilter.Count); } if (group.ColumnWidth != null) { columnCount = Math.Min(columnCount, group.ColumnWidth.Count); } for (int i = 0; i < columnCount; i++) { ShipView.Columns[i].Visible = group.ColumnFilter[i]; ShipView.Columns[i].Width = group.ColumnWidth[i]; } } SetColumnAutoSize(group.ColumnAutoSize); SetLockShipNameScroll(group.LockShipNameScroll); ShipView.ResumeLayout(); //status bar if (KCDatabase.Instance.Ships.Count > 0) { Status_ShipCount.Text = string.Format("所属: {0}隻", group.Members.Count); Status_LevelTotal.Text = string.Format("合計Lv: {0}", group.MembersInstance.Where(s => s != null).Sum(s => s.Level)); Status_LevelAverage.Text = string.Format("平均Lv: {0:F2}", group.Members.Count > 0 ? group.MembersInstance.Where(s => s != null).Average(s => s.Level) : 0); } SelectedTab = target; SelectedTab.BackColor = TabActiveColor; }
// void Start() { Init(); } // void OnEnable() { Init(); } public void Start() { Debug.Log("Initializing " + transform.name); ship = gameObject.GetComponent<Ship>(); shipView = gameObject.GetComponent<ShipView>(); modules = ship.modules; actionQueue = ship.actionQueue; // This should probably not exist; orientationController = transform.Find("Orientation").GetComponent<OrientationController>(); shipView.enabled = false; ship.runQueue = false; foreach (Transform child in transform) if (child.CompareTag("Module")) { Debug.Log("Adding " + child.name); ModuleInterface controller = child.gameObject.GetComponent(typeof(ModuleInterface)) as ModuleInterface; ship.modules.Add(child.name, controller); } // foreach (Transform child in transform) if (child.name == "ShipMesh") { // Debug.Log("Testing " + child.name); // mesh = child.gameObject.GetComponent(typeof(MeshInterface)) as MeshInterface; // } }
public PlayerPresenter(ShipView view) : base(view) { shipModel = new PlayerModel(); view.type = 3; }
public ShipPresenter(ShipView view) { this.view = view; }
public DialogAlbumMasterShip() { InitializeComponent(); Aircrafts = new ImageLabel[] { Aircraft1, Aircraft2, Aircraft3, Aircraft4, Aircraft5 }; Equipments = new ImageLabel[] { Equipment1, Equipment2, Equipment3, Equipment4, Equipment5 }; TitleHP.ImageList = TitleFirepower.ImageList = TitleTorpedo.ImageList = TitleAA.ImageList = TitleArmor.ImageList = TitleASW.ImageList = TitleEvasion.ImageList = TitleLOS.ImageList = TitleLuck.ImageList = TitleSpeed.ImageList = TitleRange.ImageList = Rarity.ImageList = Fuel.ImageList = Ammo.ImageList = TitleBuildingTime.ImageList = MaterialFuel.ImageList = MaterialAmmo.ImageList = MaterialSteel.ImageList = MaterialBauxite.ImageList = PowerUpFirepower.ImageList = PowerUpTorpedo.ImageList = PowerUpAA.ImageList = PowerUpArmor.ImageList = RemodelBeforeLevel.ImageList = RemodelBeforeAmmo.ImageList = RemodelBeforeSteel.ImageList = RemodelAfterLevel.ImageList = RemodelAfterAmmo.ImageList = RemodelAfterSteel.ImageList = ResourceManager.Instance.Icons; TitleAirSuperiority.ImageList = TitleDayAttack.ImageList = TitleNightAttack.ImageList = Equipment1.ImageList = Equipment2.ImageList = Equipment3.ImageList = Equipment4.ImageList = Equipment5.ImageList = ResourceManager.Instance.Equipments; TitleHP.ImageIndex = (int)ResourceManager.IconContent.ParameterHP; TitleFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower; TitleTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo; TitleAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA; TitleArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor; TitleASW.ImageIndex = (int)ResourceManager.IconContent.ParameterASW; TitleEvasion.ImageIndex = (int)ResourceManager.IconContent.ParameterEvasion; TitleLOS.ImageIndex = (int)ResourceManager.IconContent.ParameterLOS; TitleLuck.ImageIndex = (int)ResourceManager.IconContent.ParameterLuck; TitleSpeed.ImageIndex = (int)ResourceManager.IconContent.ParameterSpeed; TitleRange.ImageIndex = (int)ResourceManager.IconContent.ParameterRange; Fuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel; Ammo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo; TitleBuildingTime.ImageIndex = (int)ResourceManager.IconContent.FormArsenal; MaterialFuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel; MaterialAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo; MaterialSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel; MaterialBauxite.ImageIndex = (int)ResourceManager.IconContent.ResourceBauxite; PowerUpFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower; PowerUpTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo; PowerUpAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA; PowerUpArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor; RemodelBeforeAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo; RemodelBeforeSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel; RemodelAfterAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo; RemodelAfterSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel; TitleAirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter; TitleDayAttack.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane; TitleNightAttack.ImageIndex = (int)ResourceManager.EquipmentContent.Torpedo; TableBattle.Visible = false; BasePanelShipGirl.Visible = false; ControlHelper.SetDoubleBuffered( TableShipName ); ControlHelper.SetDoubleBuffered( TableParameterMain ); ControlHelper.SetDoubleBuffered( TableParameterSub ); ControlHelper.SetDoubleBuffered( TableConsumption ); ControlHelper.SetDoubleBuffered( TableEquipment ); ControlHelper.SetDoubleBuffered( TableArsenal ); ControlHelper.SetDoubleBuffered( TableRemodel ); ControlHelper.SetDoubleBuffered( TableBattle ); ControlHelper.SetDoubleBuffered( ShipView ); //ShipView Initialize ShipView.SuspendLayout(); ShipView_ShipID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; ShipView_ShipType.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; ShipView.Rows.Clear(); List<DataGridViewRow> rows = new List<DataGridViewRow>( KCDatabase.Instance.MasterShips.Values.Count( s => s.Name != "なし" ) ); foreach ( var ship in KCDatabase.Instance.MasterShips.Values ) { if ( ship.Name == "なし" ) continue; DataGridViewRow row = new DataGridViewRow(); row.CreateCells( ShipView ); row.SetValues( ship.ShipID, KCDatabase.Instance.ShipTypes[ship.ShipType].Name, ship.NameWithClass ); rows.Add( row ); } ShipView.Rows.AddRange( rows.ToArray() ); ShipView_ShipID.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; ShipView_ShipType.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; ShipView.Sort( ShipView_ShipID, ListSortDirection.Ascending ); ShipView.ResumeLayout(); }
private void shipSelected(object sender, MouseButtonEventArgs e) { ((ShipView)sender).shipRec.StrokeThickness = 5; ((ShipView)sender).shipRec.Stroke = Brushes.Blue; Selected = ((ShipView)sender); }
public EnemyPresenter(ShipView view) : base(view) { shipModel = createEnemy(); }
private void enter(object sender, MouseEventArgs e) { setViewToWater(); shipview = shipmenu.Selected; int size = 0; if (shipview != null) { size = shipview.size; Cell g = (Cell)sender; int row = g.Y; int col = g.X; x = new List<int>(); y = new List<int>(); for (int i = 0; i < size; i++) { if (shipview.Orientation.Equals(Orientation.Horizontal)) { int xPos = col + i; if (xPos < 10) { if (cells[col + i, row].rectangle.Fill != Brushes.CadetBlue) { x.Add(col + i); y.Add(row); } } else { if (cells[col - (xPos - 9), row].rectangle.Fill != Brushes.CadetBlue) { x.Add(col - (xPos - 9)); y.Add(row); } } } else { int yPos = row + i; if (yPos < 10) { if (cells[col, row + i].rectangle.Fill != Brushes.CadetBlue) { x.Add(col); y.Add(row + i); } } else { if (cells[col, row - (yPos - 9)].rectangle.Fill != Brushes.CadetBlue) { x.Add(col); y.Add(row - (yPos - 9)); } } } } Brush brush; x.Sort(); y.Sort(); if (control.checkValidPlacement(x.ToArray(), y.ToArray())) { brush = Brushes.Aqua; } else { brush = Brushes.Red; } for (int i = 0; i < x.Count; i++) { cells[x.ElementAt(i), y.ElementAt(i)].rectangle.Fill = brush; } } }