Exemple #1
0
        private ActionResult UnitSaving()
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                int             tchRoutineID = dataContainer.TeachingNode.Find(Convert.ToInt32(RouteData.Values["id"])).RoutineID;
                TeachingRoutine routine      = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);
                TeachingNode    node         = routine.NodeList[Convert.ToInt32(RouteData.Values["id"])];
                UnitSaving      tcInfo       = dataContainer.UnitSaving.FirstOrDefault(info => (info.TchRoutineID == node.RoutineID));
                ViewData[ConstDefine.ViewData_CaseText] = SharedCasePool.GetCasePool().GetRoutine(node.RoutineID).GroupList[node.GroupIdx].GroupText;
                ViewBag.RoutineName = routine.RelTmpRoutine.RoutineName;
                ViewBag.NodeName    = node.RelTmpNode.NodeName;
                ViewBag.TchNodeID   = node.Row_ID;

                return(View(node.RelTmpNode.Tag, tcInfo));
            }
        }
	public void loadUnit(UnitSaving unitSave){
		//if(unitSave.controlType != null)
		//	controlType = unitSave.controlType;
		if(unitSave.currentAttackPow != null)
			currentAttackPower = unitSave.currentAttackPow;
		if(unitSave.currentMaxAttackActions != null)
			currentMaxPosibleAttackActions = unitSave.currentMaxAttackActions;
		if(unitSave.currentMaxLength != null)
			maxProgramLength = unitSave.currentMaxLength;
		if(unitSave.currentMaxMove != null)
			maximumMovment = unitSave.currentMaxMove;
		if(unitSave.unitNameToLoad != null)
			name = unitSave.unitNameToLoad;
		if(unitSave.unitNameToLoad != null)
			name = unitSave.unitNameToLoad;
		if(unitSave.currentUnitTimer != null)
			unitTimer = unitSave.currentUnitTimer;
		if(unitSave.currentBlockLocations != null){
			for(int i = 0; i < unitSave.currentBlockLocations.Length; i++){
				addBlock(grid.gridLocationToGameGrid(unitSave.currentBlockLocations[i]), false);
			}
		}
	}
	/// <summary>
	/// Serializes the unit.
	/// Primaraly used to insure network instances are synced
	/// </summary>
	/// <returns>The unit.</returns>
	public UnitSaving serializeUnit(){
		UnitSaving serl = new UnitSaving();
		//serl.controlType = controlType;
		serl.currentAttackPow = currentAttackPower;
		serl.currentMaxAttackActions = currentMaxPosibleAttackActions;
		serl.currentMaxLength = maxProgramLength;
		serl.currentMaxMove = maximumMovment;
		serl.unitNameToLoad = name;
		serl.currentUnitTimer = unitTimer;
		GridLocation[] BL = new GridLocation[blockList.Count];
		int count = 0;
		foreach( var item in blockList ){
			BL[count++] = item.gridLocation;
		}
		return serl;
	}