Пример #1
0
        public override bool loadReader(EexBinaryReader reader)
        {
            initKVArray();
            CommandConfig cfg = ScriptConfig.Instance.getCommandConfig(Id);

            if (cfg.FieldRepeat <= 1)
            {
                for (int i = 0; i < FieldCount; i++)
                {
                    values[i] = reader.readFieldObject(keys[i]);
                }
            }
            else
            {
                for (int i = 0; i < cfg.FieldRepeat; i++)
                {
                    Object[] objs = new Object[FieldCount];
                    for (int j = 0; j < FieldCount; j++)
                    {
                        objs[j] = reader.readFieldObject(keys[j]);
                    }
                    arrayValues[i] = objs;
                }
            }

            return(true);
        }
Пример #2
0
        public bool loadReader(EexBinaryReader reader, int group)
        {
            header.loadReader(reader);

            sceneList.Clear();
            cmdIndexList.Clear();
            int sceneNum = (reader.readInt32() - 10) / 4;

            for (int i = 0; i < sceneNum; i++)
            {
                reader.setIndex(10 + i * 4);
                int pos = reader.readInt32();
                reader.setIndex(pos);
                cmdIndexList.Add(pos);
                ScriptScene scene = new ScriptScene();
                scene.loadReader(reader, group);
                sceneList.Add(scene);
                foreach (int index in scene.cmdIndexList)
                {
                    cmdIndexList.Add(index);
                }
            }
            CorrectCmdData(true);

            return(true);
        }
Пример #3
0
        public bool loadReader(EexBinaryReader reader)
        {
            flag   = reader.readFixString(4);
            short1 = reader.readUShort();
            short2 = reader.readUShort();
            short3 = reader.readUShort();

            return(true);
        }
Пример #4
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);
        }
Пример #5
0
        public bool loadNewReader(EexBinaryReader reader)
        {
            sectionList.Clear();
            int sectionNum = reader.readUShort();

            for (int j = 0; j < sectionNum; j++)
            {
                ScriptSection section = new ScriptSection();
                section.loadNewReader(reader);
                sectionList.Add(section);
            }

            return(true);
        }
Пример #6
0
        public bool loadNewReader(EexBinaryReader reader)
        {
            commandList.Clear();

            int sectionCount = reader.readUShort();

            int buildTreeCmd = -1;

            for (int i = 0; i < sectionCount; i++)
            {
                int           cmdId = reader.readUShort();
                ScriptCommand cmd   = ScriptCommand.createCommand(cmdId);
                try
                {
                    cmd.loadReader(reader, 0);
                }
                catch (EexReaderException exception)
                {
                    exception.CommandId = cmdId;
                    throw;
                }
                commandList.Add(cmd);

                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);
        }
Пример #7
0
        public bool loadNewReader(EexBinaryReader reader)
        {
            header.loadReader(reader);

            sceneList.Clear();
            int sceneNum = (reader.readInt32() - 10) / 4;

            for (int i = 0; i < sceneNum; i++)
            {
                reader.setIndex(10 + i * 4);
                int pos = reader.readInt32();
                reader.setIndex(pos);
                ScriptScene scene = new ScriptScene();
                scene.loadNewReader(reader);
                sceneList.Add(scene);
            }

            return(true);
        }
Пример #8
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);
        }
Пример #9
0
        public override bool loadReader(EexBinaryReader reader, int group)
        {
            initKVArray(group);
            CommandConfig cfg = ScriptConfig.Instance.getCommandConfig(Id, group);

            if (cfg.useFieldIds())
            {
                if (cfg.FieldRepeat <= 1)
                {
                    for (int i = 0; i < FieldCount; i++)
                    {
                        values[i] = reader.readFieldObject(keys[i]);
                    }
                }
                else
                {
                    for (int i = 0; i < cfg.FieldRepeat; i++)
                    {
                        Object[] objs = new Object[FieldCount];
                        for (int j = 0; j < FieldCount; j++)
                        {
                            objs[j] = reader.readFieldObject(keys[j]);
                        }
                        arrayValues[i] = objs;
                    }
                }
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < FieldCount; i++)
                {
                    sb.Append("0x").Append(reader.readUShort().ToString("x2")).Append(",");
                    values[i] = reader.readFieldValue(cfg.FieldTypes[i]);
                }
                String sth = sb.ToString();
                Console.WriteLine(sth);
                MessageBox.Show(sth);
            }
            return(true);
        }
Пример #10
0
 public virtual bool loadReader(EexBinaryReader reader)
 {
     return(true);
 }