Example #1
0
        public bool loadReader(EexBinaryReader reader, int group)
        {
            commandList.Clear();
            cmdIndexList.Clear();

            int sectionLen = reader.readUShort();
            int endIndex   = reader.getIndex() + sectionLen;

            int buildTreeCmd = -1;

            while (reader.getIndex() < endIndex)
            {
                int           cmdIndex = reader.getIndex();
                int           cmdId    = reader.readUShort();
                ScriptCommand cmd      = ScriptCommand.createCommand(cmdId);
                try
                {
                    cmd.loadReader(reader, group);
                }
                catch (EexReaderException exception)
                {
                    exception.CommandId = cmdId;
                    throw;
                }
                commandList.Add(cmd);
                cmdIndexList.Add(cmdIndex);

                if (buildTreeCmd != -1)
                {
                    if ((buildTreeCmd == (int)CommandId.CMD_CHILD_INFO_ACTION &&
                         cmdId == (int)CommandId.CMD_ACTION_END) ||
                        (buildTreeCmd == (int)CommandId.CMD_CHILD_ACTION))
                    {
                        buildTreeCmd = -1;
                        cmd.setExtValue(reader.readUShort());
                        continue;
                    }
                }

                switch ((CommandId)cmdId)
                {
                case CommandId.CMD_CHILD_ACTION:      // = 0x1;//子事件设定
                case CommandId.CMD_CHILD_INFO_ACTION: // = 0x2;//子事件设定带信息
                    buildTreeCmd = cmdId;
                    break;
                }
            }

            return(true);
        }
Example #2
0
        public bool loadReader(EexBinaryReader reader, int group)
        {
            sectionList.Clear();
            cmdIndexList.Clear();
            int sectionNum = reader.readUShort();

            for (int j = 0; j < sectionNum; j++)
            {
                ScriptSection section = new ScriptSection();
                cmdIndexList.Add(reader.getIndex());
                section.loadReader(reader, group);
                sectionList.Add(section);
                foreach (int index in section.cmdIndexList)
                {
                    cmdIndexList.Add(index);
                }
            }

            return(true);
        }