use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.
the class RandomWizard method constructWeightMap.
public WeightMap<E> constructWeightMap(String property, Class<? extends E> CLASS, OBJ_TYPE TYPE, boolean inverse) {
WeightMap<E> map = new WeightMap<>();
if (inverse) {
invertedMap = new LinkedHashMap<>();
}
for (String string : StringMaster.open(property)) {
Integer value = 0;
try {
value = StringMaster.getWeight(string, inverse);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
if (value <= 0) {
value = 1;
}
string = StringMaster.getWeightItem(string, inverse);
E object;
if (CLASS != ObjType.class) {
object = new EnumMaster<E>().retrieveEnumConst(CLASS, string);
} else {
object = (E) DataManager.getType(string, TYPE);
if (object == null) {
object = (E) DataManager.findType(string, TYPE);
}
}
// if (object != null) //EMPTY option allowed!
map.put(object, value);
if (inverse) {
invertedMap.put(value, object);
}
}
return map;
}
use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.
the class MacroManager method initCustomTypes.
private static void initCustomTypes() {
customTypes = new DequeImpl<>();
custom_OBJ_TYPES = new DequeImpl<>();
for (OBJ_TYPE t : MACRO_OBJ_TYPES.values()) {
File file = FileManager.getFile(getTypeDataPath() + t.getName() + ".xml");
if (!file.isFile()) {
continue;
}
custom_OBJ_TYPES.add(t);
String xml = FileManager.readFile(file);
customTypes.addAll(XML_Reader.createCustomTypeList(xml, t, MacroGame.getGame(), !isEditMode(), true, false));
// full type data or on top of base type?
}
for (ObjType type : customTypes) {
type.setGenerated(true);
DataManager.addType(type);
}
}
use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.
the class EditorPalette method init.
public void init() {
clearChildren();
clearListeners();
addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
// updateRequired=true;
return super.touchDown(event, x, y, pointer, button);
}
});
setSize(GdxMaster.getWidth() / 3 * 2, 256);
int columns = (int) (getWidth() / 64);
for (EDITOR_PALETTE sub : EDITOR_PALETTE.values()) {
OBJ_TYPE TYPE = ContentManager.getOBJ_TYPE(sub.name());
if (TYPE == null) {
addCustomTab(sub);
continue;
}
TabbedPanel tabbedPanel = new TabbedPanel();
TablePanel<Actor> table;
if (TYPE == null)
continue;
List<String> list = DataManager.getTabsGroup(TYPE);
if (list.isEmpty())
list.add("");
for (String group : list) {
table = new TablePanel<>();
table.defaults().width(64).height(64);
table.top().left().padLeft(64).padTop(64);
table.setFillParent(true);
ArrayList<ObjType> types = new ArrayList<>(DataManager.getTypesGroup(TYPE, group));
int i = 0;
int rows = 0;
for (ObjType type : types) {
TextureRegion texture = TextureCache.getOrCreateR(type.getImagePath());
ValueContainer item = new ValueContainer(texture);
item.setBackground(new NinePatchDrawable(NinePatchFactory.getTooltip()));
item.overrideImageSize(64, 64);
item.addListener(new ValueTooltip(type.getName()).getController());
item.addListener(getItemListener(item));
table.add(item).left();
item.setUserObject(type);
i++;
if (i >= columns) {
i = 0;
table.row();
rows++;
}
}
table.pack();
if (rows > 3) {
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.addElement(table);
tabbedPanel.addTab(scrollPanel, group);
} else {
tabbedPanel.addTab(table, group);
}
}
addTab(tabbedPanel, sub.name());
}
// scrollable?
}
use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.
the class AutoTargeting method select.
@Override
public boolean select(Ref ref) {
if (group != null) {
if (getConditions() != null) {
Set<Obj> filteredGroup = new Filter<Obj>(group.getObjects(), ref, getConditions()).getObjects();
group = new GroupImpl(filteredGroup);
}
ref.setGroup(this.group);
return true;
}
if (keyword != null) {
Obj obj = ref.getObj(keyword);
if (obj == null) {
return false;
}
ref.setTarget(obj.getId());
return true;
}
filter = new Filter<>(ref, getConditions());
filter.setTYPE(TYPE);
if (TYPES != null) {
ArrayList<OBJ_TYPE> types = new ArrayList<>();
for (String s : StringMaster.open(TYPES)) {
types.add(ContentManager.getOBJ_TYPE(s));
}
filter.setTYPES(types);
}
setRef(ref);
if (unlimitedTargets) {
ref.setGroup(filter.getGroup());
} else {
setLastTarget(ref.getTargetObj());
int nOfTargets = numberOfTargets.getInt(ref);
if (nOfTargets <= 0) {
return false;
}
Set<Obj> objects = filter.getObjects();
if (nOfTargets == 1) {
Obj obj = selectObj(objects);
ref.setTarget(obj.getId());
} else {
GroupImpl group = filterGroup(filter.getGroup(), nOfTargets);
ref.setGroup(group);
}
}
return true;
}
use of main.content.OBJ_TYPE in project Eidolons by IDemiurge.
the class DemoManager method initHero.
private static void initHero() {
// TODO JUST USE 'CHOOSE CENTER HERO' ?
List<ObjType> demoHeroes = new ArrayList<>();
DataManager.getTypesSubGroup(DC_TYPE.CHARS, "Demo");
Unit entity = null;
ChoiceSequence sequence = new ChoiceSequence();
sequence.addView(new EntityChoiceView(sequence, entity, demoHeroes) {
@Override
public String getInfo() {
return null;
}
@Override
protected PROPERTY getPROP() {
return null;
}
// @Override
// protected Condition getFilterConditions() {
// // return new NumericCondition("level");
// }
@Override
protected VALUE getFilterValue() {
return null;
}
protected OBJ_TYPE getTYPE() {
return DC_TYPE.CHARS;
}
});
sequence.setManager(new SequenceManager() {
@Override
public void doneSelection() {
WaitMaster.receiveInput(WAIT_OPERATIONS.SELECTION, sequence.getValue());
Launcher.resetView(VIEWS.HC);
// setLeader()
PartyHelper.loadParty(demoParty);
// initSelectedHero();
// newParty();
// launchHC();
}
@Override
public void cancelSelection() {
}
});
sequence.start();
}
Aggregations