当前位置: 首页>>代码示例>>Java>>正文


Java StringTable类代码示例

本文整理汇总了Java中skadistats.clarity.model.StringTable的典型用法代码示例。如果您正苦于以下问题:Java StringTable类的具体用法?Java StringTable怎么用?Java StringTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StringTable类属于skadistats.clarity.model包,在下文中一共展示了StringTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initStringTableEntryEvent

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@Initializer(OnStringTableEntry.class)
public void initStringTableEntryEvent(final EventListener<OnStringTableEntry> eventListener) {
    final String tableName = eventListener.getAnnotation().value();
    requestedTables.add(tableName);
    if ("*".equals(tableName)) {
        updateEventTables = requestedTables;
    } else {
        updateEventTables.add(tableName);
    }
    eventListener.setInvocationPredicate(new Predicate<Object[]>() {
        @Override
        public boolean apply(Object[] args) {
            StringTable t = (StringTable) args[0];
            return "*".equals(tableName) || t.getName().equals(tableName);
        }
    });
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:18,代码来源:BaseStringTableEmitter.java

示例2: onCreateStringTable

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnMessage(S1NetMessages.CSVCMsg_CreateStringTable.class)
public void onCreateStringTable(S1NetMessages.CSVCMsg_CreateStringTable message) {
    if (isProcessed(message.getName())) {
        StringTable table = new StringTable(
            message.getName(),
            message.getMaxEntries(),
            message.getUserDataFixedSize(),
            message.getUserDataSize(),
            message.getUserDataSizeBits(),
            message.getFlags()
        );
        decodeEntries(table, 3, message.getStringData(), message.getNumEntries());
        evCreated.raise(numTables, table);
    }
    numTables++;
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:17,代码来源:S1StringTableEmitter.java

示例3: getHeroItem

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
/**
 * Uses "EntityNames" string table and Entities processor
 * @param ctx Context
 * @param eHero Hero entity
 * @param idx 0-5 - inventory, 6-8 - backpack, 9-16 - stash
 * @return {@code null} - empty slot. Throws @{@link UnknownItemFoundException} if item information can't be extracted
 */
private Item getHeroItem(Context ctx, Entity eHero, int idx) throws UnknownItemFoundException {
    StringTable stEntityNames = ctx.getProcessor(StringTables.class).forName("EntityNames");
    Entities entities = ctx.getProcessor(Entities.class);

    Integer hItem = eHero.getProperty("m_hItems." + Util.arrayIdxToString(idx));
    if (hItem == 0xFFFFFF) {
        return null;
    }
    Entity eItem = entities.getByHandle(hItem);
    if(eItem == null) {
        throw new UnknownItemFoundException(String.format("Can't find item by its handle (%d)", hItem));
    }
    String itemName = stEntityNames.getNameByIndex(eItem.getProperty("m_pEntity.m_nameStringableIndex"));
    if(itemName == null) {
        throw new UnknownItemFoundException("Can't get item name from EntityName string table");
    }

    Item item = new Item();
    item.id = itemName;
    int numCharges = eItem.getProperty("m_iCurrentCharges");
    if(numCharges != 0) {
        item.num_charges = numCharges;
    }
    int numSecondaryCharges = eItem.getProperty("m_iSecondaryCharges");
    if(numSecondaryCharges != 0) {
        item.num_secondary_charges = numSecondaryCharges;
    }

    return item;
}
 
开发者ID:odota,项目名称:parser,代码行数:38,代码来源:Parse.java

示例4: runSeek

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
public void runSeek(String[] args) throws Exception {
    Runner runner = new SimpleRunner(new MappedFileSource(args[0])).runWith(this);
    StringTables st = runner.getContext().getProcessor(StringTables.class);
    for (String name : names) {
        StringTable t = st.forName(name);
        System.out.println(t.toString());
    }
}
 
开发者ID:skadistats,项目名称:clarity-examples,代码行数:9,代码来源:Main.java

示例5: onStringTables

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnMessage(Demo.CDemoStringTables.class)
public void onStringTables(Demo.CDemoStringTables packet) {
    for (Demo.CDemoStringTables.table_t tt : packet.getTablesList()) {
        StringTable table = stringTables.byName.get(tt.getTableName());
        if (table == null) {
            continue;
        }
        for (int i = 0; i < tt.getItemsCount(); i++) {
            Demo.CDemoStringTables.items_t it = tt.getItems(i);
            setSingleEntry(table, 2, i, it.getStr(), it.getData());
        }
    }
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:14,代码来源:BaseStringTableEmitter.java

示例6: onUpdateStringTable

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnMessage(NetMessages.CSVCMsg_UpdateStringTable.class)
public void onUpdateStringTable(NetMessages.CSVCMsg_UpdateStringTable message) {
    StringTable table = stringTables.forId(message.getTableId());
    if (table != null) {
        decodeEntries(table, 2, message.getStringData(), message.getNumChangedEntries());
    }
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:8,代码来源:S1StringTableEmitter.java

示例7: onStringTableCreated

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnStringTableCreated
public void onStringTableCreated(int tableNum, StringTable table) {
    if (byId.containsKey(tableNum) || byName.containsKey(table.getName())) {
        throw new ClarityException("String table %d (%s) already exists!", tableNum, table.getName());
    }
    byId.put(tableNum, table);
    byName.put(table.getName(), table);
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:9,代码来源:StringTables.java

示例8: onCreateStringTable

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnMessage(S2NetMessages.CSVCMsg_CreateStringTable.class)
public void onCreateStringTable(S2NetMessages.CSVCMsg_CreateStringTable message) throws IOException {
    if (isProcessed(message.getName())) {
        StringTable table = new StringTable(
            message.getName(),
            100,
            message.getUserDataFixedSize(),
            message.getUserDataSize(),
            message.getUserDataSizeBits(),
            message.getFlags()
        );

        ByteString data = message.getStringData();
        if (message.getDataCompressed()) {
            byte[] dst;
            if (context.getBuildNumber() != -1 && context.getBuildNumber() <= 962) {
                dst = LZSS.unpack(data);
            } else {
                dst = Snappy.uncompress(ZeroCopy.extract(data));
            }
            data = ZeroCopy.wrap(dst);
        }
        decodeEntries(table, 3, data, message.getNumEntries());
        evCreated.raise(numTables, table);
    }
    numTables++;
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:28,代码来源:S2StringTableEmitter.java

示例9: onUpdateStringTable

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnMessage(NetMessages.CSVCMsg_UpdateStringTable.class)
public void onUpdateStringTable(NetMessages.CSVCMsg_UpdateStringTable message) throws IOException {
    StringTable table = stringTables.forId(message.getTableId());
    if (table != null) {
        decodeEntries(table, 2, message.getStringData(), message.getNumChangedEntries());
    }
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:8,代码来源:S2StringTableEmitter.java

示例10: onTableEntry

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnStringTableEntry("ActiveModifiers")
public void onTableEntry(StringTable table, int index, String key, ByteString value) throws InvalidProtocolBufferException {
    if (value != null) {
        DotaModifiers.CDOTAModifierBuffTableEntry message = DotaModifiers.CDOTAModifierBuffTableEntry.parseFrom(value);
        evEntry.raise(message);
    }
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:8,代码来源:Modifiers.java

示例11: onStringTableCreated

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
@OnStringTableCreated
public void onStringTableCreated(int numTables, StringTable table) {
    names.add(table.getName());
    System.out.println(table.getName());
}
 
开发者ID:skadistats,项目名称:clarity-examples,代码行数:6,代码来源:Main.java

示例12: run

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
public void run(String[] args) throws Exception {
    long tStart = System.currentTimeMillis();

    int tick = Integer.valueOf(args[0]);
    String demoName = args[1];

    ControllableRunner r = new ControllableRunner(new MappedFileSource(demoName)).runWith(this);
    r.seek(tick);
    r.halt();

    Context ctx = r.getContext();

    File dir = new File(String.format("baselines%s%s", File.separator, ctx.getBuildNumber() == -1 ? "latest" : ctx.getBuildNumber()));
    if (!dir.exists()) {
        dir.mkdirs();
    }

    FieldReader fieldReader = ctx.getEngineType().getNewFieldReader();

    StringTables stringTables = ctx.getProcessor(StringTables.class);
    DTClasses dtClasses = ctx.getProcessor(DTClasses.class);
    StringTable baselines = stringTables.forName("instancebaseline");

    for (int i = 0; i < baselines.getEntryCount(); i++) {
        DTClass dtClass = dtClasses.forClassId(Integer.valueOf(baselines.getNameByIndex(i)));
        String fileName = String.format("%s%s%s.txt", dir.getPath(), File.separator, dtClass.getDtName());
        log.info("writing {}", fileName);
        fieldReader.DEBUG_STREAM = new PrintStream(new FileOutputStream(fileName), true, "UTF-8");
        BitStream bs = BitStream.createBitStream(baselines.getValueByIndex(i));
        try {
            fieldReader.readFields(bs, dtClass, dtClass.getEmptyStateArray(), true);
            if (bs.remaining() < 0 || bs.remaining() > 7) {
                log.info("-- OFF: {} remaining", bs.remaining());
            }
        } catch (Exception e) {
            log.info("-- FAIL: {}", e.getMessage());
            e.printStackTrace(fieldReader.DEBUG_STREAM);
        } finally {
        }
    }

    long tMatch = System.currentTimeMillis() - tStart;
    log.info("total time taken: {}s", (tMatch) / 1000.0);
}
 
开发者ID:skadistats,项目名称:clarity-examples,代码行数:45,代码来源:Main.java

示例13: S1CombatLogEntry

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
public S1CombatLogEntry(S1CombatLogIndices indices, StringTable combatLogNames, GameEvent event) {
    this.indices = indices;
    this.combatLogNames = combatLogNames;
    this.e = event;
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:6,代码来源:S1CombatLogEntry.java

示例14: S2CombatLogEntry

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
public S2CombatLogEntry(StringTable combatLogNames, DotaUserMessages.CMsgDOTACombatLogEntry entry) {
    this.combatLogNames = combatLogNames;
    this.e = entry;
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:5,代码来源:S2CombatLogEntry.java

示例15: setSingleEntry

import skadistats.clarity.model.StringTable; //导入依赖的package包/类
protected void setSingleEntry(StringTable table, int mode, int index, String key, ByteString value) {
    table.set(mode, index, key, value);
    raise(table, index, key, value);
}
 
开发者ID:skadistats,项目名称:clarity,代码行数:5,代码来源:BaseStringTableEmitter.java


注:本文中的skadistats.clarity.model.StringTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。