Пример #1
0
    public void SetupActionReport()
    {
        if (currentTravellerReport.myTravellerData.actionsDealt == null || currentTravellerReport.myTravellerData.actionsDealt.Count <= 0)
        {
            return;
        }

        if (actionList == null)
        {
            actionList = new List <TypeWriterEffectUI>();
        }

        for (int i = 0; i < currentTravellerReport.myTravellerData.actionsDealt.Count; i++)
        {
            GameObject tmp = (GameObject)Instantiate(sentencePrefab);
            tmp.transform.SetParent(sentenceParent);

            TypeWriterEffectUI tmpWriter = tmp.GetComponent <TypeWriterEffectUI>();
            actionList.Add(tmpWriter);

            tmpWriter.SetTypeWriterMessage(currentTravellerReport.myTravellerData.actionsDealt[i], true);
        }
        if (actionList.Count > 0)
        {
            noActionsTaken.SetActive(false);
        }
        myWindow.OpenWindow();
    }
Пример #2
0
        public void SummonAllSentence()
        {
            if (currentConversation == null)
            {
                return;
            }

            if (currentDialogueIdx >= currentConversation.dialoguePattern.Count)
            {
                return;
            }

            summoningAllSentences = true;

            for (int i = currentDialogueIdx; i < currentConversation.dialoguePattern.Count; i++)
            {
                GameObject tmp = (GameObject)Instantiate(speechTextPrefab);
                tmp.transform.SetParent(speechParent.transform);

                TypeWriterEffectUI tmpWriter = tmp.GetComponent <TypeWriterEffectUI>();
                speechList.Add(tmpWriter);
                tmpWriter.deliveryType      = myDeliveryType;
                tmpWriter.intervalPerLetter = mesgSpeed;

                if (currentDialogueIdx < currentConversation.dialoguePattern.Count - 1)
                {
                    tmpWriter.SetTypeWriterMessage(currentConversation.dialoguePattern[currentDialogueIdx].GetDialogue(), true, () => FadeAndSummonLastSentence(tmpWriter), ShowEffects);
                }
                else
                {
                    tmpWriter.SetTypeWriterMessage(currentConversation.dialoguePattern[currentDialogueIdx].GetDialogue(), true, EndConversation);
                }

                if (currentDialogueIdx < currentConversation.dialoguePattern.Count)
                {
                    currentDialogueIdx += 1;
                }
            }
        }
Пример #3
0
    public void CallNextWriter(string mesg, TypeWriterEffectUI destroyThis)
    {
        actionList.Remove(destroyThis);
        DestroyImmediate(destroyThis.gameObject);

        GameObject temp = (GameObject)Instantiate(sentencePrefab);

        temp.transform.SetParent(sentenceParent);

        TypeWriterEffectUI tempWriter = temp.GetComponent <TypeWriterEffectUI>();

        actionList.Add(tempWriter);

        tempWriter.SetTypeWriterMessage(mesg, true);

        UpdateUnitCountReport();
        RevealIconReport();
        UpdateRelationshipReport();
    }
Пример #4
0
    public void CheckCasualties()
    {
        casualtyRewardObject.gameObject.SetActive(true);
        StartCoroutine(casualtyRewardObject.WaitAnimationForAction(casualtyRewardObject.openAnimationName, EnableButton));

        if (sentencesCreated == null)
        {
            sentencesCreated = new List <TypeWriterEffectUI>();
        }
        for (int i = 0; i < playerCommander.unitsCarried.Count; i++)
        {
            string text = playerCommander.unitsCarried[i].totalDeathCount + " " + playerCommander.unitsCarried[i].unitInformation.unitName + " died";

            GameObject tmp = (GameObject)Instantiate(sentencePrefab);
            tmp.transform.SetParent(sentenceParent);

            TypeWriterEffectUI typeWriter = tmp.GetComponent <TypeWriterEffectUI>();
            typeWriter.SetTypeWriterMessage(text, true);
            sentencesCreated.Add(typeWriter);
        }
    }
Пример #5
0
    public void AddAction(int actionIdx)
    {
        string tmp        = "[Week 1]";
        string prePurpose = "Purpose";

        if (PlayerGameManager.GetInstance != null)
        {
            tmp = "[Week " + PlayerGameManager.GetInstance.playerData.weekCount + "]";
        }

        switch (actionIdx)
        {
        case 0:     // SCOUTING
            if (currentTravellerReport.myTravellerData.scoutSentSuccessfully)
            {
                return;
            }
            prePurpose = "When We Tried to scout them.||..";
            if (PlayerGameManager.GetInstance != null)
            {
                if (PlayerGameManager.GetInstance.playerData.GetTotalTroops <= 0)
                {
                    tmp += "We dont have troops to scout them!";
                }
                else
                {
                    CheckScoutSuccess();

                    if (currentTravellerReport.myTravellerData.scoutSentSuccessfully)
                    {
                        tmp += "Scout mission success! revealing info!";
                    }
                    else
                    {
                        tmp += "Scout Mission failed! " + PlayerGameManager.GetInstance.playerData.RemoveScoutTroops() + " sent died.";
                    }
                }
            }
            else
            {
                CheckScoutSuccess();

                if (currentTravellerReport.myTravellerData.scoutSentSuccessfully)
                {
                    tmp += "Scout mission success! revealing info!";
                }
                else
                {
                    if (PlayerGameManager.GetInstance != null)
                    {
                        tmp += "Scout Mission failed! " + PlayerGameManager.GetInstance.playerData.RemoveScoutTroops() + " sent died.";
                    }
                    else
                    {
                        tmp += "Scout Mission failed! a Troop send died.";
                    }
                }
            }
            break;

        case 1:     // Send Gift
            if (PlayerGameManager.GetInstance != null && PlayerGameManager.GetInstance.playerData.coins < 100)
            {
                tmp += "Plentiful Food, but we need coins!";
            }
            else
            {
                List <TravellerFlavourPhrase> travellerTexts = currentTravellerReport.myTravellerData.GetRelationshipFlavorText();
                if (travellerTexts.Count > 0)
                {
                    prePurpose = "We approach them with gifts.||..";
                    int rand = UnityEngine.Random.Range(0, travellerTexts.Count);
                    tmp += travellerTexts[rand].flavourText;
                    currentTravellerReport.myTravellerData.UpdateRelationship(10);
                    myController.CheckRelationship(currentTravellerReport.myTravellerData.relationship);

                    if (PlayerGameManager.GetInstance != null)
                    {
                        PlayerGameManager.GetInstance.playerData.coins -= 100;
                    }
                }
            }
            break;

        case 2:
            if (TransitionManager.GetInstance == null || PlayerGameManager.GetInstance == null)
            {
                return;
            }
            EventBroadcaster.Instance.PostEvent(EventNames.HIDE_RESOURCES);
            prePurpose = "Their intentions were bad! so we decided to.||..";
            tmp       += "Engaged In battle!";

            PlayerGameManager.GetInstance.unitsToSend = PlayerGameManager.GetInstance.ConvertWholeGarrisonAsTraveller();
            StartCoroutine(myPanel.WaitAnimationForAction(myPanel.closeAnimationName, () => TransitionManager.GetInstance.FaceTravellerInBattle(currentTravellerReport.myTravellerData, false)));

            engagedToBattle = true;

            if (TransitionManager.GetInstance.isNewGame)
            {
                PlayerGameGuide.GetInstance.HideGuideText();
            }
            break;

        default:
            break;
        }

        if (currentTravellerReport.myTravellerData.actionsDealt == null)
        {
            currentTravellerReport.myTravellerData.actionsDealt = new List <string>();
        }
        currentTravellerReport.myTravellerData.actionsDealt.Add(tmp);

        GameObject preTemp = (GameObject)Instantiate(sentencePrefab);

        preTemp.transform.SetParent(sentenceParent);

        TypeWriterEffectUI preTempWriter = preTemp.GetComponent <TypeWriterEffectUI>();

        actionList.Add(preTempWriter);
        preTempWriter.SetTypeWriterMessage(prePurpose, true, () => CallNextWriter(currentTravellerReport.myTravellerData.actionsDealt[currentTravellerReport.myTravellerData.actionsDealt.Count - 1], preTempWriter));

        noActionsTaken.SetActive(false);
    }
Пример #6
0
    public void StartMessageSample()
    {
        int rand = UnityEngine.Random.Range(0, messageList.Count);

        mesgText.SetTypeWriterMessage(messageList[rand], true, StartMessageSample);
    }
Пример #7
0
        public void SummonSentenceText()
        {
            if (currentConversation == null)
            {
                return;
            }

            if (currentDialogueIdx >= currentConversation.dialoguePattern.Count)
            {
                return;
            }

            GameObject tmp = (GameObject)Instantiate(speechTextPrefab);

            tmp.transform.SetParent(speechParent.transform);

            TypeWriterEffectUI tmpWriter = tmp.GetComponent <TypeWriterEffectUI>();

            speechList.Add(tmpWriter);

            if (indexReactioncallBack != null && indexReactioncallBack.Count > 0)
            {
                DialogueIndexReaction reaction = indexReactioncallBack.Find(x => x.dialogueIndex == currentDialogueIdx);
                if (reaction != null)
                {
                    if (reaction.potentialCallback == null)
                    {
                        Debug.Log("Callback for reaction Index:" + reaction.dialogueIndex + " is Unavailable!");
                    }
                    else
                    {
                        reaction.potentialCallback();
                        if (reaction.moveDialogueUp)
                        {
                            MovePanelUp();
                        }
                        else if (reaction.moveDialogueDown)
                        {
                            MovePanelDown();
                        }

                        indexReactioncallBack.Remove(reaction);
                    }
                }
            }

            if (currentConversation.dialoguePattern[currentDialogueIdx].type == DialogueType.Single)
            {
                tmpWriter.allowMesgControl  = true;
                tmpWriter.isDialogueMesg    = true;
                tmpWriter.deliveryType      = myDeliveryType;
                tmpWriter.intervalPerLetter = mesgSpeed;

                Sprite talkingIcon = TransitionManager.GetInstance.unitStorage.GetUnitIcon(currentConversation.dialoguePattern[currentDialogueIdx].charName);
                characterIcon.sprite = talkingIcon;

                if (currentDialogueIdx < currentConversation.dialoguePattern.Count - 1)
                {
                    tmpWriter.SetTypeWriterMessage(currentConversation.dialoguePattern[currentDialogueIdx].GetDialogue(), true, () => FadeAndSummonLastSentence(tmpWriter), ShowEffects);
                }
                else
                {
                    if (summoningAllSentences)
                    {
                        tmpWriter.SetTypeWriterMessage(currentConversation.dialoguePattern[currentDialogueIdx].GetDialogue(), true);
                    }
                    else if (currentDialogueIdx < currentConversation.dialoguePattern.Count - 1)
                    {
                        tmpWriter.SetTypeWriterMessage(currentConversation.dialoguePattern[currentDialogueIdx].GetDialogue(), true);
                    }
                    else if (currentDialogueIdx == (currentConversation.dialoguePattern.Count - 1))
                    {
                        tmpWriter.SetTypeWriterMessage(currentConversation.dialoguePattern[currentDialogueIdx].GetDialogue(), true, EndConversation);
                    }
                }
                if (currentDialogueIdx < currentConversation.dialoguePattern.Count)
                {
                    currentDialogueIdx += 1;
                }
            }
        }