/* * /// <summary> * /// Adds certain unit to the unic creation stripe as a possibility of creation a new unit * /// </summary> * /// <param name="p"></param> * private void AddUnitCreation(short p) { * short o; * if (buldingCounter[p] == 1) { * BuildingData b = sim.GameSettingsWrapper.buildingsMap[p]; * foreach (string s in b.UnitsCanProduce) { * if (sim.GameSettingsWrapper.namesToIds.TryGetValue(s, out o)) { * OnNewUnit(s, currPlayer.Race); * } * } * } * } * * /// <summary> * /// Checks requied building needed to build requested one * /// </summary> * /// <param name="coll"></param> * /// <returns></returns> * private bool CheckReqBuildingsToAddNewBuilding(BuildingsNames coll) { * foreach (String buildingName in coll) { * short id; * short count; * if (sim.GameSettingsWrapper.namesToIds.TryGetValue(buildingName, out id)) { * if (buldingCounter.TryGetValue(id, out count)) { * if (count == 0) * return false; * } else return false; * } else return false; * } * return true; * } */ internal void DeployMCV() { if (_selectedUnits.Count == 0) { return; } Unit u = _selectedUnits[0]; if (u.BoardObjectClass != BoardObjectClass.UnitMCV) { return; } /* * destroy mcv, so that the construction yard can be built * i think we HAVE TO send ANOTHER MESSAGE to server, ie: * MessageDeployMCV, because the MCV has to be destroyed * synchronously */ // v remove (workaround), send MessageDeployMCV instead /*short constructionYardId = GlobalSettings.Wrapper.namesToIds["ConstructionYard"]; * Position newPos = new Position(u.Position.X + 1, u.Position.Y); * this.CreateBuilding(newPos, constructionYardId,-1);*/ // ^ GMDeployMCV msgMVC = (GMDeployMCV)MessageFactory.Create(MessageType.DeployMCV); msgMVC.IdPlayer = CurrentPlayer.Id; msgMVC.McvID = u.ObjectID; Connection.Instance.SendMessage(msgMVC); }
protected abstract void onMessageDeployMCV(GMDeployMCV dmcv);