// Play against AI // Found at: PracticePickerTrayDisplay search for StartGame private void pratice_mode(bool expert) { if (just_joined) { return; } // Don't do this, if we're currently in a game // TODO: Change to an assertion if (SceneMgr.Get().IsInGame()) { return; } // Delay 5 seconds for loading and such // TODO: Smarter delaying Delay(5000); Log.log("Joining game in practice mode, expert = " + expert); // Get the ID of the current Deck long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID(); // Get a random mission, of selected difficulty MissionID missionID = getRandomAIMissionID(expert); // Start up the game GameMgr.Get().StartGame(GameMode.PRACTICE, missionID, selectedDeckID); // Set status GameMgr.Get().UpdatePresence(); just_joined = true; }
public static void MarkCompletedMissionAsDead(MissionID missionID) { Mission tempMission = GetMission(missionID); tempMission.CurrentObjectiveDescription = tempMission.ObjectiveCompleted; if (tempMission.MissionState.Equals(StateOfMission.CompletedDead)) { return; } else if (tempMission.MissionState.Equals(StateOfMission.Completed)) { foreach (Item reward in tempMission.RewardItems) { ShipInventoryManager.AddItem(reward); } StatsManager.progress += tempMission.ProgressReward; StatsManager.reputation += tempMission.ReputationReward; StatsManager.Crebits += tempMission.MoneyReward; tempMission.OnCompleted(); tempMission.MissionState = StateOfMission.CompletedDead; } RefreshLists(); }
protected Mission(Game1 Game, string section, MissionID missionID) { this.Game = Game; this.section = section; this.missionID = missionID; configFile = new ConfigFile(); configFile.Load("Data/missiondata.dat"); }
protected Mission(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : this(Game, section, missionID) { if (spriteSheet != null) { this.spriteSheet = spriteSheet; } }
// Found at: DeckPickerTrayDisplay search for RankedMatch private void tournament_mode(bool ranked) { if (just_joined) { return; } // Don't do this, if we're currently in a game, or matching a game // TODO: Change to an assertion if (SceneMgr.Get().IsInGame() || Network.IsMatching()) { return; } // Delay 5 seconds for loading and such // TODO: Smarter delaying Delay(5000); // If we're not set to the right mode, now is the time to do so // Note; This does not update the GUI, only the internal state bool is_ranked = Options.Get().GetBool(Option.IN_RANKED_PLAY_MODE); if (is_ranked != ranked) { Options.Get().SetBool(Option.IN_RANKED_PLAY_MODE, ranked); return; } Log.log("Joining game in tournament mode, ranked = " + ranked); // Get the ID of the current Deck long selectedDeckID = DeckPickerTrayDisplay.Get().GetSelectedDeckID(); // We want to play vs other players MissionID missionID = MissionID.MULTIPLAYER_1v1; // Ranked or unranked? GameMode mode = ranked ? GameMode.RANKED_PLAY : GameMode.UNRANKED_PLAY; // Setup up the game GameMgr.Get().SetNextGame(mode, missionID); // Do network join if (ranked) { Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_PLAY_TOURNAMENT_WITH_CUSTOM_DECK); Network.RankedMatch(selectedDeckID); } else { Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_PLAY_CASUAL_WITH_CUSTOM_DECK); Network.UnrankedMatch(selectedDeckID); } // Set status FriendChallengeMgr.Get().OnEnteredMatchmakerQueue(); GameMgr.Get().UpdatePresence(); just_joined = true; }
void init(MissionID mid, DateTime start, int days) { this.id = mid; this.start = start; this.days = days; //this.end = start.AddDays(days); //DateTime.Now.ToString("hh:mm:ss"); //TimeSpan span = endTime.Subtract ( startTime ); //Console.WriteLine( "Time Difference (seconds): " + span.Seconds ); }
public void init( MissionID mid, GameObject parent, Vector3 position, bool freeze = false, Vector3?localPosition = null, Vector3?localScale = null) { mission = GameControl.missiondb.get_mission(mid); if (mission == null) { Debug.LogError("MissionBall: mid " + mid.id + " not found"); return; } //Debug.Log ("MissionBall: mid " + mid.id + " size:" + mission.size.ToString()+ // " prefab:"+"Prefabs/MissionBalls/"+mission.balltype); //sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); gem = Instantiate( Resources.Load("Prefabs/MissionBalls/" + mission.balltype), position, Quaternion.identity, parent.transform) as GameObject; gem.name = mission.id.id; if (localScale != null) { gem.transform.localScale = (Vector3)localScale; } else { float bsiz = 0.5f + mission.size / 4.0f; gem.transform.localScale = new Vector3(bsiz, bsiz, bsiz); } if (localPosition != null) { gem.transform.localPosition = (Vector3)localPosition; } //MeshRenderer mr = sphere.GetComponent<MeshRenderer>(); //Debug.Log (mr); //Material mat = Resources.Load("Materials/proto_map") as Material; //Debug.Log (mat); //mr.material = mat; //Debug.Log ("MissionBall: Instantiantion successful"); if (freeze) { gem.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ; Collider collider = gameObject.transform.GetComponentInChildren <Collider> (); collider.enabled = false; } }
public static void RemoveAvailableMission(MissionID missionID) { Mission tempMission = GetMission(missionID); if (tempMission.MissionState.Equals(StateOfMission.Available)) { tempMission.MissionState = StateOfMission.Unavailable; } RefreshLists(); }
public static Mission GetMission(MissionID missionID) { foreach (Mission mission in missions) { if (mission.MissionID.Equals(missionID)) { return(mission); } } throw new ArgumentException("Mission not found"); }
public void failed_mission(MissionID mid) { Mission m = missiondb.get_mission(mid); if (m == null) { Debug.LogError("failed_mission mission not found!"); return; } Debug.Log("FailedMission: completed=" + pad.completed_missions.Count + " ongoing=" + pad.ongoing_missions.Count); pad.ongoing_missions.RemoveAll(MissionID.ByMID(mid)); Debug.Log("FailedMission: completed=" + pad.completed_missions.Count + " ongoing=" + pad.ongoing_missions.Count); }
public void commence_mission(MissionID mid) { Mission m = missiondb.get_mission(mid); if (m == null) { Debug.LogError("commence_mission mission not found!"); return; } Debug.Log("CommenceMission: completed=" + pad.completed_missions.Count + " ongoing=" + pad.ongoing_missions.Count); pad.ongoing_missions.Add( new OngoingMission(mid, m.days)); Debug.Log("CommenceMission: completed=" + pad.completed_missions.Count + " ongoing=" + pad.ongoing_missions.Count); }
public Mission(MissionID mid, string title, int size, int days, string balltype, int level, string short_desc, string long_desc, MissionID upgrade = null, MissionID downgrade = null) { this.id = mid; this.title = title; this.size = size; this.days = days; this.balltype = balltype; this.level = level; this.short_desc = short_desc; this.long_desc = long_desc; this.upgrade = upgrade; this.downgrade = downgrade; }
public static void UnlockMission(MissionID missionID) { Mission tempMission = GetMission(missionID); if (tempMission.MissionState.Equals(StateOfMission.Available)) { return; } else { tempMission.MissionState = StateOfMission.Available; } RefreshLists(); }
//Sets the state of the mission sent in to COMPLETED public static void MarkMissionAsCompleted(MissionID missionID) { Mission tempMission = GetMission(missionID); if (tempMission.MissionState.Equals(StateOfMission.Completed) || tempMission.MissionState.Equals(StateOfMission.CompletedDead)) { return; } else if (activeMissions.Contains(tempMission)) { tempMission.MissionState = StateOfMission.Completed; removedActiveMissions.Add(tempMission); tempMission.CurrentObjectiveDescription = tempMission.ObjectiveCompleted; } RefreshLists(); }
//Sets the state of the mission sent in to ACTIVE public static void MarkMissionAsActive(MissionID missionID) { Mission tempMission = GetMission(missionID); if (tempMission.MissionState.Equals(StateOfMission.Active)) { return; } else if (tempMission.MissionState.Equals(StateOfMission.Available)) { tempMission.MissionState = StateOfMission.Active; tempMission.StartMission(); foreach (Objective obj in tempMission.Objectives) { obj.OnMissionStart(); } } RefreshLists(); }
public static void MarkFailedMissionAsDead(MissionID missionID) { Mission tempMission = GetMission(missionID); if (tempMission.MissionState.Equals(StateOfMission.FailedDead)) { return; } else if (tempMission.MissionState.Equals(StateOfMission.Failed)) { if (!tempMission.IsRestartAfterFail()) { tempMission.MissionState = StateOfMission.FailedDead; } else { ResetMission(tempMission.MissionID); } } //RefreshLists(); }
public static void ResetMission(MissionID missionID) { Mission tempMission = GetMission(missionID); if (tempMission.MissionState.Equals(StateOfMission.Active) || tempMission.MissionState.Equals(StateOfMission.Failed)) { tempMission.OnReset(); tempMission.MissionState = StateOfMission.Available; if (tempMission.MissionState.Equals(StateOfMission.Active)) { removedActiveMissions.Add(tempMission); } } else { return; } RefreshLists(); }
public Main2_1_TheConvoy(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main1_2_ToHighfence(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main1_1_RebelsInTheAsteroids(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Side_DebtCollection(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { }
public Main9_B_AllianceArc(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main3_DefendColony(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main7_Information(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main9_C_OnYourOwnArc(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main8_2_TheEnd(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Main6_InTheNameOfScience(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { isMainMission = true; }
public Side_AstroScan(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { RestartAfterFail(); }
public Side_AstroDodger(Game1 Game, string section, Sprite spriteSheet, MissionID missionID) : base(Game, section, spriteSheet, missionID) { }
public void init(MissionID mid, GameObject parent, Vector3 position) { omi = GameControl.control.get_ongoing_mission(mid); if (omi == null) { Debug.LogError("MissionButton: mid " + mid.id + " not ongoing"); return; } mission = GameControl.missiondb.get_mission(mid); UnityEngine.Object mission_prefab; switch (omi.get_timing()) { case OngoingMission.Timing.Ongoing: mission_prefab = Resources.Load("Prefabs/MissionButtons/OngoingMission"); break; case OngoingMission.Timing.Ended: mission_prefab = Resources.Load("Prefabs/MissionButtons/EndedMission"); break; default: case OngoingMission.Timing.Overdue: mission_prefab = Resources.Load("Prefabs/MissionButtons/OverdueMission"); break; } button = Instantiate( mission_prefab, new Vector3(0, 0, 0), Quaternion.identity, parent.transform) as GameObject; button.name = mission.id.id; button.transform.localScale = new Vector3(1, 1, 1); button.transform.localPosition = position; //Debug.Log ("MissionButton: Instantiantion successful"); Button uibutton = button.GetComponent <Button>(); uibutton.onClick.AddListener(() => { button_clicked(); }); // Setup sphere ball = button.AddComponent <MissionBall> (); ball.init(mid, button, new Vector3(0, 0, 0), true, new Vector3(-140f, 0f, 0f), new Vector3(40f, 40f, 0.4f)); // Setup text mission_title = button.GetComponentInChildren <Text> (); mission_title.text = mission.title; // Setup timer mission_timer = button.GetComponentInChildren <Slider> (); if (omi.get_timing() != OngoingMission.Timing.Overdue) { TimeSpan remain = omi.get_remaining_time(); mission_timer.maxValue = omi.days * 24 * 60; mission_timer.minValue = 0; mission_timer.value = (int)remain.TotalMinutes; mission_timer_text = mission_timer.GetComponentInChildren <Text> (); mission_timer_text.text = mission_timer_text.text = omi.get_remaining_time_description(); } else { mission_timer.enabled = false; } }