コード例 #1
0
    //Read from file "Dialogue.text"
    void PopulateDialogue()
    {
        string       line;
        StreamReader r = new StreamReader("Assets/Text/Dialogue.txt");

        using (r)
        {
            do
            {
                line = r.ReadLine();
                if (line != null)
                {
                    string[]        lineData   = line.Split(';');
                    DialogueChoices tempchoice = new DialogueChoices();
                    tempchoice.question      = lineData[0];
                    tempchoice.choiceRight   = lineData[1];
                    tempchoice.choiceWrong   = lineData[2];
                    tempchoice.responseRight = lineData[3];
                    tempchoice.responseWrong = lineData[4];


                    alldialogues.Add(tempchoice);
                }
            } while (line != null);
            r.Close();
        }
    }
コード例 #2
0
    //After dialogue has finished playing, show the player their choices
    void DisplayChoices()
    {
        if (currentDialogue < conversation.Count)
        {
            List <string> choices = new List <string>(conversation[currentDialogue].choices);
            if (choices.Count == 0)
            {
                choices.Add("Continue");
            }
            choices.Add("Pardon?");
            DialogueChoices.ActivateDialogueOptions(choices, this);
        }
        else
        {
            //conversation is finished
            if (methods[currentDialogue] != null)
            {
                methods[currentDialogue](0);
            }
            GameManager.PlayerCanMove(true);
            PlayOnSchedule.allowed = true;

            foreach (Renderer r in GetComponentsInChildren <Renderer>())
            {
                Destroy(r.gameObject.GetComponent <Outline>());
            }
            Destroy(this);
        }
    }
コード例 #3
0
 public void Change(DialogueChoices _choices)
 {
     RemoveChoices();
     choices = _choices;
     gameObject.SetActive(true);
     Intialize();
 }
コード例 #4
0
 public void SetupDialogue()
 {
     myDialogue = Instantiate(dialogueBoxPrefab, GameObject.FindGameObjectWithTag("MainCanvas").transform).GetComponent <DialogueChoices>();
     myDialogue.SetupDialogue(myDialogueType, GetComponent <ClickForDialogueBox>());
     if (onPopupPageOpen != null)
     {
         onPopupPageOpen.DisableBackButton();
     }
     StartCoroutine(WaitForResponse());
 }
コード例 #5
0
        ////////////////

        private void BeginShot02_InteriorChat(IntroCutscene cutscene)
        {
            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            //

            var plrPos = new Vector2(
                (this.Set.InteriorTileLeft + 46) * 16,
                (this.Set.InteriorTileTop + 37) * 16
                );

            Player plr = Main.player[cutscene.PlaysForWhom];

            plr.position = plrPos;

            //

            this.IsSiezingControls      = true;
            this.IsCutscenePlayerImmune = false;

            //

            this.Dialogue = new DialogueChoices(
                dialogue: "We're under attack! Do we stay and fight?",
                portrait: ModContent.GetTexture("CutsceneLib/ExampleCutscene/IntroCutscene/guide_head"),
                height: 224,
                choices: new List <string> {
                "Bring it!", "Must escape!"
            },
                (choice) => {
                this.ChoiceMade = choice;
                this.Dialogue.HideDialogue();
            }
                );
        }
コード例 #6
0
    //Create 15 prisoners to interact with
    void CreatePrisoners()
    {
        for (int i = 0; i < 15; i++)
        {
            Prisoner temp = new Prisoner();

            //Set a random name
            int random = Random.Range(0, Allnames.Count);
            temp.name = Allnames[random];
            //delete name from Allnames so we don't get a repeat
            Allnames.RemoveAt(random);

            if (temp.name.Equals("Harada"))
            {
                temp.difficulty = 5;
                temp.crime      = "???";
                temp.converted  = false;

                //Set up Dialogue!!!!!
                DialogueChoices tempdia = new DialogueChoices();
                tempdia.question      = "Ah. You.";
                tempdia.choiceRight   = "Y-yes?";
                tempdia.choiceWrong   = "What?";
                tempdia.responseRight = "Good luck.";
                tempdia.responseWrong = "Nothing.";

                temp.diachoices = new List <DialogueChoices>();
                temp.diachoices.Add(tempdia);
            }
            else
            {
                //Set a random difficulty for this guy
                temp.difficulty = Random.Range(1, 5);

                //Set a random crime
                random     = Random.Range(0, Allcrimes.Count);
                temp.crime = Allcrimes[random].crimename;

                //Set converted to false unless difficulty is 0
                if (temp.difficulty == 0)
                {
                    temp.converted = true;
                    convertedpri.Add(temp);
                }
                else
                {
                    temp.converted = false;
                }
                // Debug.Log("Name: "+temp.name);

                //Now set up the Dialogue for them
                temp.diachoices = new List <DialogueChoices>();
                List <DialogueChoices> deleted = new List <DialogueChoices>();
                for (int j = 0; j < 4; j++)
                {
                    int             randdia = Random.Range(0, alldialogues.Count);
                    DialogueChoices holdme  = alldialogues[randdia];
                    deleted.Add(holdme);
                    temp.diachoices.Add(holdme);
                    alldialogues.RemoveAt(randdia);

                    Debug.Log(temp.diachoices[j].question);
                }
                //Put the removed dialogues back in
                for (int j = 0; j < 4; j++)
                {
                    alldialogues.Add(deleted[j]);
                }

                //Crime-specific dialogue
                DialogueChoices tempdia = new DialogueChoices();

                //  Debug.Log("Criminal count: "+Allcrimes.Count+"\nRandom Number: "+random);

                tempdia.question      = Allcrimes[random].crimedia.question;
                tempdia.choiceRight   = Allcrimes[random].crimedia.choiceRight;
                tempdia.choiceWrong   = Allcrimes[random].crimedia.choiceWrong;
                tempdia.responseRight = Allcrimes[random].crimedia.responseRight;
                tempdia.responseWrong = Allcrimes[random].crimedia.responseWrong;
                temp.diachoices.Add(tempdia);
            }

            Debug.Log("Name: " + temp.name + "\tCrime: " + temp.crime + "\tDifficulty: " + temp.difficulty);

            allprisoners.Add(temp);
        }
    }
コード例 #7
0
 public void OutputFile(OutFiles type, string fileName, DialogueChoices.DialogueChoicesControl choicesControl, Dictionary<string, int> DTEtable)
 {
     dialogueModule.OutputFile(type, fileName, choicesControl, DTEtable);
 }
コード例 #8
0
        public void OutputFile(OutFiles type, string fileName, DialogueChoices.DialogueChoicesControl choicesControl, Dictionary<string, int> DTEtable)
        {
            System.Resources.ResourceManager res = new System.Resources.ResourceManager("AtelierElieScripter.Res.GameFiles", System.Reflection.Assembly.GetExecutingAssembly());
            Encoding enc = System.Text.Encoding.GetEncoding("iso-8859-1");

            switch (type)
            {
                case OutFiles.EV1:
                    FileStream fs = new FileStream(fileName, FileMode.Create);
                    BinaryWriter bw = new BinaryWriter(fs, enc);
                    bw.Write((Byte[])res.GetObject("EV_001"));
                    uint writePos;
                    writePos = EmptyRange.Ranges[0].Begin;
                    for (int i = 0; i < 0x27; i++)
                    {
                        mainBlocks[i].OutputFile(bw, 0, writePos, DTEtable);
                        writePos = (uint)bw.BaseStream.Position;
                    }
                    writePos = EmptyRange.Ranges[1].Begin;
                    for (int i = 27; i < 0x49; i++)
                    {
                        mainBlocks[i].OutputFile(bw, 1, writePos, DTEtable);
                        writePos = (uint)bw.BaseStream.Position;
                    }
                    writePos = EmptyRange.Ranges[2].Begin;
                    for (int i = 49; i < 0x7e; i++)
                    {
                        mainBlocks[i].OutputFile(bw, 2, writePos, DTEtable);
                        writePos = (uint)bw.BaseStream.Position;
                    }

                    break;
                case OutFiles.EV4:
                    break;
                case OutFiles.EV7:
                    break;
                case OutFiles.EVCB:
                    break;
                case OutFiles.EVREQUEST:
                    break;
            }
        }