Exemplo n.º 1
0
        public void SetSelectedMercenary(MercenaryData pMercenary)
        {
            AppUI.Instance.SetSelectedMercenary(pMercenary);

            // Set the tab sprites to indicate the selected mercenary
            foreach (RectTransform tab in mercenaryUIContainer.GetComponentsInChildren <RectTransform>())
            {
                if (tab != mercenaryUIContainer && tab.GetComponent <MercenaryUI>())
                {
                    if (tab.GetComponent <MercenaryUI>().Data == AppUI.Instance.SelectedMercenary)
                    {
                        tab.GetComponent <Image>().sprite = mercenaryTabSprites[1];
                    }
                    else
                    {
                        tab.GetComponent <Image>().sprite = mercenaryTabSprites[0];
                    }
                }
            }

            // Update the text in the right side of the mercenary panel
            AppUI.Instance.MercenaryName.text   = AppUI.Instance.SelectedMercenary.Name;
            AppUI.Instance.MercenaryRank.text   = "Rank " + AppUI.Instance.SelectedMercenary.Stats.Rank;
            AppUI.Instance.MercenarySkills.text = ParseSkillsList(AppUI.Instance.SelectedMercenary);
            AppUI.Instance.MercenaryStats.text  = ParseStats(AppUI.Instance.SelectedMercenary);
        }
Exemplo n.º 2
0
        public string ParseSkillsList(MercenaryData pData)
        {
            string s = "";

            foreach (Skill skill in pData.Stats.Skills)
            {
                if (skill.ToString().Length < 8)
                {
                    s += skill.Name.ToString() + "\t\t" + skill.Bonus + "\n";
                }
                else
                {
                    s += skill.Name.ToString() + "\t" + skill.Bonus + "\n";
                }
            }

            if (s != "")
            {
                return(s);
            }
            else
            {
                return("None");
            }
        }
Exemplo n.º 3
0
        public Notification(TaskType pType, EncounterEvent pEvent, string pLabel, int pDayLimit = 0, MercenaryData pMercenary = null, HexTile pTile = null)
        {
            mercenary = pMercenary;
            tile      = pTile;
            type      = pType;
            myEvent   = pEvent;

            dayLimit = pDayLimit;

            label = pLabel;
        }
Exemplo n.º 4
0
        public void InitializeNewEncounter(EncounterEvent e, MercenaryData m)
        {
            // Swap to the Encounter ui page
            AppUI.Instance.SwitchPage(5);

            // Set up the encounter UI
            SetActiveEncounter(e);
            SetActiveMercenary(m);

            currentEncounterStep = 0;
            LoadEncounterStep(currentEncounterStep);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a string that describes a task within a notification
        /// </summary>
        /// <returns>Label to be inserted for this notification in the canvas object.</returns>
        public string ParseNotificationLabel(TaskType pType, MercenaryData pMerc)
        {
            string s = pMerc.Name;

            switch (pType)
            {
            case TaskType.DUNGEONEER: s += " is traveling to a dungeon."; break;

            case TaskType.FORAGE: s += " is foraging for materials."; break;

            case TaskType.SCOUT: s += " is scouting a new area."; break;

            case TaskType.TRAIN: s += " is training in the wild."; break;

            case TaskType.RANDOM: s += " encountered something in the wild!"; break;
            }

            return(s);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Given a task type, mercenary, and tile, generate a notification that can be parsed and sent to the UI.
        /// </summary>
        /// <returns>Notification object containing an event.</returns>
        public Notification GenerateNotification(TaskType pType, MercenaryData pMercenary, HexTile pTile, EncounterEvent pEndEvent = null)
        {
            // Get a random event object from the event manifest for the given type. It should contain information as to
            // whether the event is clear-required.

            int lDayLimit = 0;

            foreach (HexTile t in pMercenary.CurrentPath)
            {
                lDayLimit += HexFunctions.Instance.GetRoughTerrainFactor(t.Type);
            }

            if (pType.Equals(TaskType.DUNGEONEER))
            {
                return(new Notification(pType, EncounterController.Instance.DungeoneeringEvent, ParseNotificationLabel(pType, pMercenary), lDayLimit, pMercenary, pTile));
            }

            // Return the generated notification.
            return(new Notification(pType, pEndEvent, ParseNotificationLabel(pType, pMercenary), lDayLimit, pMercenary, pTile));
        }
        /// <summary>
        /// When a notification is clicked, either focus to its tile and select its mercenary,
        /// or go to the resolution.
        /// </summary>
        /// <param name="index">index of the notification to check in the notifications list</param>
        public void ClickNotification(int index)
        {
            // Should focus on the tile the merc is currently on and open the merc's page
            if (Notifications[index].DayLimit != 0)
            {
                TileSelector.Instance.SetTarget(Notifications[index].Mercenary.Location);

                AppUI.Instance.SetSelectedMercenary(Notifications[index].Mercenary);
                AppUI.Instance.SwitchPage(2);
            }
            // Should resolve the notification
            else
            {
                Notifications[index].Resolve();

                MercenaryData m = Notifications[index].Mercenary;
                Notifications.RemoveAt(index);

                UpdateNotificationUI();
                UpdateNotificationBadgeText();
                AppUI.Instance.UpdateMercInteractionButton(m);
            }
        }
Exemplo n.º 8
0
 public void SetMercenaryTask(MercenaryData pMercenary, TaskType pTaskType, HexTile pTile)
 {
 }
Exemplo n.º 9
0
        private IEnumerator SetMission()
        {
            // Get the selected mercenary
            selectedTask = TaskType.NONE;
            MercenaryData m = AppUI.Instance.SelectedMercenary;

            if (m == null)
            {
                yield break;
            }

            // Collapse the left menu

            AppUI.Instance.ToggleLeftMenu();

            // Show the "Select a Tile" text

            AppUI.Instance.ToggleSelectTileText(m.Name);

            // Wait for a tile to be selected and confirmed

            yield return(new WaitUntil(() => (Input.GetButtonDown("Submit") && TileSelector.Instance.TargetTile != null)));

            HexTile tile = TileSelector.Instance.TargetTile;

            AppUI.Instance.ToggleSelectTileText();

            // Pop up the task type selection dialog
            // Perform logic here for choosing options to show based on tile type
            DialogManager.Instance.ShowDialog(DialogType.TASK_SELECT);

            int  it             = 1;
            bool didButtonCheck = false;

            if (!didButtonCheck)
            {
                foreach (RectTransform r in TaskTray.transform)
                {
                    if (r == TaskTray)
                    {
                        continue;
                    }

                    r.gameObject.GetComponent <Button>().interactable = IsValidTaskForTile((TaskType)it, tile);

                    it++;
                }
            }

            // wait for a task to be selected
            yield return(new WaitUntil(() => (selectedTask != TaskType.NONE)));

            // Close the selection dialog
            DialogManager.Instance.CloseAllDialogs();

            // Pass the task to the mercenary data
            AppUI.Instance.SelectedMercenary.SetPath(MercenaryController.Instance.GetTaskPath(m.Location, tile));

            // Generate a corresponding notification and push it to the panel
            NotificationController.Instance.AddNotification(GenerateNotification(selectedTask, m, tile, EncounterController.Instance.GetRandomEncounter()));

            AppUI.Instance.UpdateMercInteractionButton(m);

            AppUI.Instance.SwitchPage(0);

            // reset selectedtask
            selectedTask = TaskType.NONE;

            yield return(null);
        }
Exemplo n.º 10
0
 public void SetActiveMercenary(MercenaryData pMercenary)
 {
     ActiveMercenary = pMercenary;
 }
Exemplo n.º 11
0
 public string ParseStats(MercenaryData pData)
 {
     return("Mind\t" + pData.Stats.Mind + "\nBody\t" + pData.Stats.Body + "\nSpirit\t" + pData.Stats.Spirit);
 }