public void SetAnswer(ref int i, List <Action> actions)
        {
            string temp = actions[i].GetStringFromParameter(0);
            Line   line = new Line(temp);

            Lines.Add(line);
            LineActions.Add(actions[i]);
            IsAnswer = true;
        }
        public void SetConversation(ref int i, List <Action> actions)
        {
            Actions = actions;

            UInt32 opCode = actions[i].OpCode;

            OldAddress = actions[i].OldAddress;

            while (opCode == Action.ACTION_NAME || opCode == Action.ACTION_TEXT || opCode == Action.ACTION_PLACE)
            {
                if (opCode == Action.ACTION_NAME)
                {
                    if (Name == null)
                    {
                        Name       = new Line(actions[i].GetStringFromParameter(0));
                        NameAction = actions[i];
                    }
                }
                else if (opCode == Action.ACTION_PLACE)
                {
                    string temp = actions[i].GetStringFromParameter(3);

                    Line line = new Line(temp);

                    Lines.Add(line);
                    PlaceActions.Add(actions[i]);
                }
                else
                {
                    string temp = actions[i].GetStringFromParameter(0);

                    Line line = new Line(temp);

                    Lines.Add(line);
                    LineActions.Add(actions[i]);
                }
                i++;
                ActionsEnd = i;
                if (i >= actions.Count)
                {
                    break;
                }

                opCode = actions[i].OpCode;
            }

            i--;
        }
        public void AddLine(bool isNew = false, int index = -1)
        {
            if (!IsAnswer && ((NameAction == null && Lines.Count < 10) || Lines.Count < 3))
            {
                Action action = new Action(0, Action.ACTION_TEXT, 1);
                Line   line   = new Line("");

                if (index == -1 || index == Lines.Count)
                {
                    Lines.Add(line);
                    LineActions.Add(action);
                    Actions.Insert(ActionsEnd + (isNew ? AmountInserted : 0), action);
                }
                else
                {
                    Lines.Insert(index, line);
                    LineActions.Insert(index, action);
                    Actions.Insert(ActionsEnd - (index == 0 ? 1 : index), action);
                }

                AmountInserted++;
            }
        }
Example #4
0
 public void ReadFrom(BinaryReader reader)
 {
     Index  = reader.ReadByte();
     Action = (LineActions)reader.ReadByte();
 }
 public void DeleteLine(int index)
 {
     Lines.Remove(Lines[index]);
     Actions.Remove(LineActions[index]);
     LineActions.Remove(LineActions[index]);
 }