예제 #1
0
 private void DetermineCharacterContact()
 {
     Debug.Log(this.name);
     if (this.name == "EricTheRed")
     {
         characterName = "Erik The Red";
         activeContact = characterDataService.GetKeyFigureChoice("EricTheRed");
     }
     else if (this.name == "Illugi")
     {
         characterName = "Illugi";
         activeContact = characterDataService.GetKeyFigureChoice("Illugi");
     }
     else if (this.name == "ShipCaptain")
     {
         characterName = "Ship Captain";
         activeContact = characterDataService.GetKeyFigureChoice("ShipCaptain");
     }
     else if (this.name == "Glaumur")
     {
         characterName = "Glaumur";
         activeContact = characterDataService.GetKeyFigureChoice("Glaumur");
     }
     else
     {
         activeContact = characterDataService.GetRandomContact();
     }
 }
예제 #2
0
    public void ActivateOrDeactivateBtn(GameObject btn, GameDataModel.Contact contact, int choiceIndex)
    {
        if (btn == null)
        {
            return;
        }

        if ((contact.choices.Length - 1) < choiceIndex)
        {
            btn.SetActive(false);
            return;
        }

        GameDataModel.Choice choice = contact.choices[choiceIndex];
        // choice.RemoveDupContactId(contact.id);
        if (CheckChoice(choice, contact))
        {
            Debug.Log(contact.id);
            Debug.Log(choice.text);
            Debug.Log(choice.contacts[0].id);
            characterContactService = btn.GetComponentInChildren <CharacterContactService>();
            btn.GetComponentInChildren <Text> ().text = choice.text;
            btn.SetActive(true);
            characterContactService.SetContact(contact);
        }
        else
        {
            btn.SetActive(false);
        }
    }
예제 #3
0
 private GameDataModel.Choice[] FilterOutContactInChoices(GameDataModel.Contact contact)
 {
     GameDataModel.Choice[] choices = new GameDataModel.Choice[totalBtns];
     // for (int x = 0; x < contact.choices.Length; x++) {
     //  if (contact.choices[x].contacts)
     // }
     return(choices);
 }
예제 #4
0
 public void ActivateMenuBtns(GameDataModel.Contact contact)
 {
     GameObject[]           btns         = GatherButtons();
     GameDataModel.Choice[] validChoices = FilterOutContactInChoices(contact);
     ResetAllBtns(btns);
     for (int x = 0; x < totalBtns; x++)
     {
         // if (validChoices[x] != null) {
         ActivateOrDeactivateBtn(btns[x], contact, x);
         // } else {
         //  btns[x].SetActive(false);
         // }
     }
 }
예제 #5
0
    public void ModifyMenuMessage(GameDataModel.Contact nextContact)
    {
        message.GetComponent <Text>().text = nextContact.text;

        if (nextContact.itemGranted != null)
        {
            string itemFound = nextContact.itemGranted;
            item.SetActive(true);
            item.GetComponentInChildren <Text> ().text = "Item Granted: " + itemFound;
        }
        else
        {
            item.SetActive(false);
        }
    }
예제 #6
0
 private bool CheckChoice(GameDataModel.Choice choice, GameDataModel.Contact contact)
 {
     if (choice.requirement != "")
     {
         return(isRequirementMet(choice) && TaskNotCompleted(choice.requirement));
     }
     else if (choice.itemGone != "")
     {
         return(isItemGone(choice) && TaskNotCompleted(choice.itemGone));
     }
     else if (choice.contacts.Length > 1 && choice.contacts[1].id == contact.id)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #7
0
    public void nonCloseResponse(int choice)
    {
        GameDataModel.Contact currentContact = this.GetComponentInParent <CharacterContactService>().GetContact();
        nextContact = GetNextChoice(currentContact, choice);

        if (nextContact == null)
        {
            closeMenu();
            return;
        }

        menuDataService.ActivateMenuBtns(nextContact);
        menuDataService.ModifyMenuMessage(nextContact);

        if (nextContact.itemGranted != null)
        {
            string item = nextContact.itemGranted;
            inventoryDataService.ItemFound(nextContact.itemGranted);
            gameMessage.GetComponent <Text>().text = "You are given a " + item + ".";
        }
    }
예제 #8
0
 private GameDataModel.Contact GetNextChoice(GameDataModel.Contact current, int choice)
 {
     return(characterDataService.GetNextChoice(current, choice));
 }
예제 #9
0
 public void SetContact(GameDataModel.Contact contact)
 {
     this.contact = contact;
 }