protected void Page_Load(object sender, EventArgs e) { mUser = (AppUser)Session[Constants.SESS_KEY_USER]; if (mUser == null) { getUserFromCookie(); if (mUser == null) { Response.Redirect("login.aspx"); Response.Close(); return; } } RewardID = Request.Params["RewardID"]; achievedWhen = PilotClass.WhenAchieved(Guid.Parse(RewardID), mUser.UserEmail); rd = RewardDefinition.getRewardDefinition(Guid.Parse(RewardID)); IEnumerable <RewardPrereq> prereqs = RewardPrereq.getPrereqs(Guid.Parse(RewardID)); requirements = new List <AchievementDefinition>(); if (prereqs != null && prereqs.Count <RewardPrereq>() >= 0) { foreach (RewardPrereq pcp in prereqs) { AchievementDefinition ad = AchievementDefinition.getAchievementDefinition(pcp.RequiredAchievement); requirements.Add(ad); } } // now we have the list of requirements too. }
/// <summary> /// See all the achievements that are unlocked by this task. if they arent already conferred, confer them /// Recalculate rewards unlocked by the achievement, if they arent already conferred, confer them /// Recalculate Pilot levels unlocked by the achievement if they arent already conferred, confer them /// </summary> /// <param name="dc"></param> /// <param name="taskID"></param> /// <param name="email"></param> private void ProcessTaskDependents(DBClassesDataContext dc, Guid taskID, string email) { // recalculate achievements for this pilot List <Guid> Achievements = RecalculateAchievements(dc, email); // save these achievements if (Achievements.Count > 0) { PilotAchievement.saveAchievements(dc, email, Achievements); } dc.SubmitChanges(); // Now calculate all rewards which are unlocked by this achievement List <Guid> Rewards = RecalculateRewards(dc, email, Achievements); if (Rewards.Count > 0) { PilotReward.saveRewards(dc, email, Rewards); } dc.SubmitChanges(); // Now calculate all rewards which are unlocked by this achievement List <Guid> Levels = RecalculateLevels(dc, email, Achievements); if (Rewards.Count > 0) { PilotClass.saveClasses(dc, email, Levels); } dc.SubmitChanges(); }
public void OnDrop(PointerEventData eventData) { dragged = PilotDisplayPanelController.draggedPilot; gameObject.name = dragged.GetComponent <PilotDisplayPanelController>().thisPanelPilot.pilotName; pilotNameObject.text = dragged.GetComponent <PilotDisplayPanelController>().thisPanelPilot.pilotName; pilotImageObject.sprite = Resources.Load <Sprite>("UnitIcons/Pilots/" + dragged.GetComponent <PilotDisplayPanelController>().thisPanelPilot.iconFileName); assignedPilot = dragged.GetComponent <PilotDisplayPanelController>().thisPanelPilot; Destroy(dragged); }
protected void Page_Load(object sender, EventArgs e) { mUser = (AppUser)Session[Constants.SESS_KEY_USER]; if (mUser == null) { getUserFromCookie(); if (mUser == null) { Response.Redirect("login.aspx"); Response.Close(); return; } } PilotClasses = PilotClass.getPilotClassesForPilot(mUser.UserEmail); Achievements = PilotAchievement.getAchievementsForPilot(mUser.UserEmail); Rewards = PilotReward.getRewardsForPilot(mUser.UserEmail); }
public void OnBeginDrag(PointerEventData eventData) { GetComponent <CanvasGroup>().blocksRaycasts = false; originPoint = transform.parent; if (isUnit == true) { thisPilot = null; } else { thisUnit = null; } if (isUnit) { UnitDisplayPanelController.draggedUnit = this.gameObject; } if (!isUnit) { PilotDisplayPanelController.draggedPilot = this.gameObject; } }
public void OnDrop(PointerEventData eventData) { Debug.Log(UnitDisplayPanelController.draggedUnit); Debug.Log(PilotDisplayPanelController.draggedPilot); if (occupied == true) { if (eventData.pointerDrag.tag == "Deployment") { if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().thisPilot != null) { if (assignedPilot != null) { otherPanel.pilots.Add(assignedPilot); otherPanel.SetWindow(2); assignedPilot = null; Destroy(instantiatedPilotIcon); } } if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().thisUnit != null) { if (assignedMech != null) { otherPanel.mechs.Add(assignedMech); otherPanel.SetWindow(0); assignedVehicle = null; Destroy(instantiatedUnitIcon); } else if (assignedVehicle != null) { otherPanel.vehicles.Add(assignedVehicle); otherPanel.SetWindow(1); assignedVehicle = null; Destroy(instantiatedUnitIcon); } } } else if (eventData.pointerDrag.tag == "NotDeployment") { if (screenState == 2) { if (assignedPilot != null) { otherPanel.pilots.Add(assignedPilot); otherPanel.pilots.Remove(eventData.pointerDrag.GetComponent <PilotDisplayPanelController>().thisPanelPilot); otherPanel.SetWindow(2); assignedPilot = null; Destroy(instantiatedPilotIcon); } } else if (screenState == 1 || screenState == 0) { if (assignedVehicle != null) { otherPanel.vehicles.Add(assignedVehicle); if (screenState == 1) { otherPanel.vehicles.Remove(eventData.pointerDrag.GetComponent <UnitDisplayPanelController>().thisPanelUnit); otherPanel.SetWindow(1); } else if (screenState == 0) { otherPanel.mechs.Remove(eventData.pointerDrag.GetComponent <UnitDisplayPanelController>().thisPanelUnit); otherPanel.SetWindow(0); } assignedVehicle = null; Destroy(instantiatedUnitIcon); } else if (assignedMech != null) { otherPanel.mechs.Add(assignedMech); if (screenState == 1) { otherPanel.vehicles.Remove(eventData.pointerDrag.GetComponent <UnitDisplayPanelController>().thisPanelUnit); otherPanel.SetWindow(1); } else if (screenState == 0) { otherPanel.mechs.Remove(eventData.pointerDrag.GetComponent <UnitDisplayPanelController>().thisPanelUnit); otherPanel.SetWindow(0); } assignedVehicle = null; Destroy(instantiatedUnitIcon); } } } } if (eventData.pointerDrag.tag == "NotDeployment") { if (screenState == 2) { draggedObject = eventData.pointerDrag; assignedPilot = draggedObject.GetComponent <PilotDisplayPanelController>().thisPanelPilot; instantiatedPilotIcon = Instantiate(pilotIconPanel, pilotIconSpawn); instantiatedPilotIcon.GetComponent <Image>().sprite = Resources.Load <Sprite>("UnitIcons/Pilots/" + assignedPilot.iconFileName); instantiatedPilotIcon.GetComponent <DeploymentIconDragController>().canvasTopLayer = canvasTopLayer; instantiatedPilotIcon.GetComponent <DeploymentIconDragController>().previousSlot = this; instantiatedPilotIcon.GetComponent <DeploymentIconDragController>().thisPilot = assignedPilot; pilotNameObject.text = assignedPilot.pilotName; if (occupied == false) { otherPanel.pilots.Remove(assignedPilot); } PilotDisplayPanelController.draggedPilot = null; Destroy(draggedObject); occupied = true; } else if (screenState == 1) { draggedObject = eventData.pointerDrag; assignedVehicle = draggedObject.GetComponent <UnitDisplayPanelController>().thisPanelUnit; instantiatedUnitIcon = Instantiate(unitIconPanel, unitIconSpawn); instantiatedUnitIcon.GetComponent <Image>().sprite = Resources.Load <Sprite>("UnitIcons/Units/" + assignedVehicle.iconFileName); instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().canvasTopLayer = canvasTopLayer; instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().previousSlot = this; instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().thisUnit = assignedVehicle; instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().isUnit = true; unitNameObject.text = assignedVehicle.unitName; if (occupied == false) { otherPanel.vehicles.Remove(assignedVehicle); } UnitDisplayPanelController.draggedUnit = null; Destroy(draggedObject); occupied = true; } else if (screenState == 0) { draggedObject = eventData.pointerDrag; assignedMech = draggedObject.GetComponent <UnitDisplayPanelController>().thisPanelUnit; instantiatedUnitIcon = Instantiate(unitIconPanel, unitIconSpawn); instantiatedUnitIcon.GetComponent <Image>().sprite = Resources.Load <Sprite>("UnitIcons/Units/" + assignedMech.iconFileName); instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().canvasTopLayer = canvasTopLayer; instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().previousSlot = this; instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().thisUnit = assignedMech; instantiatedUnitIcon.GetComponent <DeploymentIconDragController>().isUnit = true; unitNameObject.text = assignedMech.unitName; if (occupied == false) { otherPanel.mechs.Remove(assignedMech); } UnitDisplayPanelController.draggedUnit = null; Destroy(draggedObject); occupied = true; } } else if (eventData.pointerDrag.tag == "Deployment") { if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().thisUnit != null) { draggedObject = eventData.pointerDrag; DeploymentIconDragController draggedObjectScript = draggedObject.GetComponent <DeploymentIconDragController>(); draggedObjectScript.originPoint = unitIconSpawn; if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().previousSlot.assignedVehicle != null) { assignedVehicle = draggedObjectScript.thisUnit; draggedObjectScript.previousSlot.assignedVehicle = null; Destroy(instantiatedUnitIcon); instantiatedUnitIcon = eventData.pointerDrag; eventData.pointerDrag.GetComponent <DeploymentIconDragController>().previousSlot.occupied = false; } else if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().previousSlot.assignedMech != null) { assignedMech = draggedObjectScript.thisUnit; draggedObjectScript.previousSlot.assignedMech = null; Destroy(instantiatedUnitIcon); instantiatedUnitIcon = eventData.pointerDrag; eventData.pointerDrag.GetComponent <DeploymentIconDragController>().previousSlot.occupied = false; } draggedObjectScript.NewLocation(); draggedObjectScript.previousSlot = this; UnitDisplayPanelController.draggedUnit = null; occupied = true; } if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().thisPilot != null) { draggedObject = eventData.pointerDrag; DeploymentIconDragController draggedObjectScript = draggedObject.GetComponent <DeploymentIconDragController>(); draggedObjectScript.originPoint = pilotIconSpawn; if (eventData.pointerDrag.GetComponent <DeploymentIconDragController>().previousSlot.assignedPilot != null) { assignedPilot = draggedObjectScript.thisPilot; draggedObjectScript.previousSlot.assignedPilot = null; Destroy(instantiatedPilotIcon); instantiatedPilotIcon = eventData.pointerDrag; eventData.pointerDrag.GetComponent <DeploymentIconDragController>().previousSlot.occupied = false; } draggedObjectScript.previousSlot.assignedPilot = null; draggedObjectScript.NewLocation(); draggedObjectScript.previousSlot = this; PilotDisplayPanelController.draggedPilot = null; occupied = true; } } }
void Start() { assignedVehicle = null; assignedMech = null; assignedPilot = null; }