本文整理汇总了C++中PlayerObject::addSuiBox方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::addSuiBox方法的具体用法?C++ PlayerObject::addSuiBox怎么用?C++ PlayerObject::addSuiBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::addSuiBox方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendInputBox
void SuiManager::sendInputBox(SceneObject* terminal, SceneObject* player, const String& play, const String& callback, const String& prompt, const String& button) {
if (terminal == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiInputBox*> confirmSui = new SuiInputBox(creature, 0x00);
confirmSui->setCallback(new LuaSuiCallback(creature->getZoneServer(), play, callback));
confirmSui->setUsingObject(terminal);
confirmSui->setPromptText(prompt);
confirmSui->setOkButton(true, button);
confirmSui->setOtherButton(false, "");
confirmSui->setCancelButton(false, "");
confirmSui->setForceCloseDistance(32);
creature->sendMessage(confirmSui->generateMessage());
playerObject->addSuiBox(confirmSui);
}
}
示例2: sendMessageBox
void SuiManager::sendMessageBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, const String& okButton, const String& screenplay, const String& callback) {
if (usingObject == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiMessageBox*> messageBox = new SuiMessageBox(creature, 0x00);
messageBox->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
messageBox->setPromptTitle(title);
messageBox->setPromptText(text);
messageBox->setUsingObject(usingObject);
messageBox->setOkButton(true, okButton);
messageBox->setCancelButton(true, "@cancel");
messageBox->setForceCloseDistance(32.f);
creature->sendMessage(messageBox->generateMessage());
playerObject->addSuiBox(messageBox);
}
}
示例3: doMusicSelection
void JukeboxImplementation::doMusicSelection(CreatureObject* player) {
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL)
return;
PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();
if (playerManager == NULL)
return;
ManagedReference<SuiListBox*> listbox = new SuiListBox(player, SuiWindowType::JUKEBOX_SELECTION);
listbox->setCallback(new JukeboxSelectionSuiCallback(server->getZoneServer()));
listbox->setPromptTitle("@event_perk_jukebox_songs:songs_t"); // Music Select
listbox->setPromptText("@event_perk_jukebox_songs:songs_d"); // Select a song to play from the list below.
listbox->setUsingObject(_this.getReferenceUnsafeStaticCast());
listbox->setForceCloseDistance(32.f);
listbox->setCancelButton(true, "@cancel");
int songListSize = playerManager->getNumJukeboxSongs();
JukeboxSong* song = NULL;
for (int i = 0; i < songListSize; i++) {
song = playerManager->getJukeboxSong(i);
if (song != NULL) {
listbox->addMenuItem(song->getStringId());
}
}
ghost->addSuiBox(listbox);
player->sendMessage(listbox->generateMessage());
}
示例4: sendItemListSUI
void ScavengerDroidImplementation::sendItemListSUI(CreatureObject* player) {
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL)
return;
if (itemList.size() == 0) {
player->sendSystemMessage("@event_perk:scavenger_no_items");
return;
}
ManagedReference<SuiListBox*> listbox = new SuiListBox(player, SuiWindowType::SCAVENGER_ITEM_LIST);
listbox->setPromptTitle("@event_perk:scavenger_list_t"); // Scavenger Hunt List
listbox->setPromptText("@event_perk:scavenger_list_d"); // Below you will find the list of items you need to find for the scavenger hunt. Good luck!
listbox->setUsingObject(_this.getReferenceUnsafeStaticCast());
listbox->setForceCloseDistance(32.f);
listbox->setCancelButton(true, "@cancel");
for (int i = 0; i < itemList.size(); i++) {
String itemTemplate = itemList.get(i);
listbox->addMenuItem(TemplateManager::instance()->getTemplate(itemTemplate.hashCode())->getObjectName());
}
ghost->addSuiBox(listbox);
player->sendMessage(listbox->generateMessage());
}
示例5: sendListBox
void SuiManager::sendListBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, const uint8& numOfButtons, const String& cancelButton, const String& otherButton, const String& okButton, LuaObject& options, const String& screenplay, const String& callback) {
if (usingObject == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiListBox*> box = NULL;
switch (numOfButtons) {
case 1:
box = new SuiListBox(creature, 0x00, SuiListBox::HANDLESINGLEBUTTON);
box->setCancelButton(false, "");
box->setOtherButton(false, "");
box->setOkButton(true, okButton);
break;
case 2:
box = new SuiListBox(creature, 0x00, SuiListBox::HANDLETWOBUTTON);
box->setCancelButton(true, cancelButton);
box->setOtherButton(false, "");
box->setOkButton(true, okButton);
break;
case 3:
box = new SuiListBox(creature, 0x00, SuiListBox::HANDLETHREEBUTTON);
box->setCancelButton(true, cancelButton);
box->setOtherButton(true, otherButton);
box->setOkButton(true, okButton);
break;
default:
return;
break;
}
if(options.isValidTable()){
for(int i = 1; i <= options.getTableSize(); ++i){
String optionString = options.getStringAt(i);
box->addMenuItem(optionString);
}
options.pop();
}
box->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
box->setPromptTitle(title);
box->setPromptText(text);
box->setUsingObject(usingObject);
box->setForceCloseDistance(32.f);
creature->sendMessage(box->generateMessage());
playerObject->addSuiBox(box);
}
}
示例6: handleObjectMenuSelect
int CoaMessageMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
if (!player->isPlayerCreature()) {
return 0;
}
if (!sceneObject->isASubChildOf(player)) {
player->sendSystemMessage("@encoded_disk/message_fragment:sys_not_in_inv"); // The disk can't be used unless it is in your inventory!
return 0;
}
TangibleObject* disk = cast<TangibleObject*>(sceneObject);
if (disk == NULL) {
return 0;
}
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL) {
return 0;
}
if (selectedID == 20) {
CoaMessageDataComponent* data = cast<CoaMessageDataComponent*>(disk->getDataObjectComponent()->get());
if (data == NULL) {
return 0;
}
String title = disk->getObjectName()->getFullPath();
StringBuffer body;
body << "@encoded_disk/message_fragment:complete_event";
if (data->getFaction().toLowerCase() == "imperial") {
body << "imp1\n\n" << "@encoded_disk/message_fragment:frag_eventimp1_" << String::valueOf(data->getNumber());
} else if (data->getFaction().toLowerCase() == "rebel") {
body << "reb1\n\n" << "@encoded_disk/message_fragment:frag_eventreb1_" << String::valueOf(data->getNumber());
} else {
return 0;
}
ManagedReference<SuiMessageBox*> box = new SuiMessageBox(player, SuiWindowType::COA_MESSAGE);
box->setPromptTitle(title);
box->setPromptText(body.toString());
box->setUsingObject(disk);
box->setOkButton(true, "@close");
ghost->addSuiBox(box);
player->sendMessage(box->generateMessage());
return 0;
}
return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
示例7: sendGameInstructionsSUI
void ScavengerDroidImplementation::sendGameInstructionsSUI(CreatureObject* player) {
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL)
return;
ManagedReference<SuiMessageBox*> msgBox = new SuiMessageBox(player, SuiWindowType::SCAVENGER_INFO);
msgBox->setPromptTitle("@event_perk:scavenger_instruction"); // Instructions
msgBox->setPromptText("@event_perk:scavenger_game_instruction"); // Choose "View Item List" to see what items you need to find. As you find items, show me the item by dragging and dropping them onto me. The first person to find all of the items wins!
msgBox->setUsingObject(_this.getReferenceUnsafeStaticCast());
msgBox->setForceCloseDistance(32.f);
ghost->addSuiBox(msgBox);
player->sendMessage(msgBox->generateMessage());
}
示例8: sendSetupInstructionsSUI
void ScavengerDroidImplementation::sendSetupInstructionsSUI(CreatureObject* player) {
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL)
return;
ManagedReference<SuiMessageBox*> msgBox = new SuiMessageBox(player, SuiWindowType::SCAVENGER_INFO);
msgBox->setPromptTitle("@event_perk:scavenger_instruction"); // Instructions
msgBox->setPromptText("@event_perk:scavenger_setup_instruction"); // Drag and drop items onto me so I can look at them and I will add them to the scavenger hunt list. You can look at the items you've added by selecting "View List". If you've made a mistake, select "Reset" to start again. When you are ready, choose "Start Game" to begin.
msgBox->setUsingObject(_this.getReferenceUnsafeStaticCast());
msgBox->setForceCloseDistance(32.f);
ghost->addSuiBox(msgBox);
player->sendMessage(msgBox->generateMessage());
}
示例9: handleObjectMenuSelect
int CoaMessageFragmentMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
if (!player->isPlayerCreature()) {
return 0;
}
if (!sceneObject->isASubChildOf(player)) {
player->sendSystemMessage("@encoded_disk/message_fragment:sys_not_in_inv"); // The disk can't be used unless it is in your inventory!
return 0;
}
TangibleObject* fragment = cast<TangibleObject*>(sceneObject);
if (fragment == NULL) {
return 0;
}
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL) {
return 0;
}
if (selectedID == 20) {
String title = fragment->getCustomObjectName().toString();
StringBuffer body;
body << "@encoded_disk/message_fragment:text_event";
if (title.contains("Imperial")) {
body << "imp1";
} else if (title.contains("Rebel")) {
body << "reb1";
} else {
return 0;
}
ManagedReference<SuiMessageBox*> box = new SuiMessageBox(player, SuiWindowType::COA_MESSAGE_FRAGMENT);
box->setCallback(new CoaMessageFragmentSuiCallback(player->getZoneServer()));
box->setPromptTitle(title);
box->setPromptText(body.toString());
box->setUsingObject(fragment);
box->setCancelButton(true, "@close");
box->setOkButton(true, "@encoded_disk/message_fragment:combine");
ghost->addSuiBox(box);
player->sendMessage(box->generateMessage());
return 0;
}
return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
示例10: sendTransferBox
void SuiManager::sendTransferBox(SceneObject* usingObject, SceneObject* player, const String& title, const String& text, LuaObject& optionsAddFrom, LuaObject& optionsAddTo, const String& screenplay, const String& callback) {
if (usingObject == NULL)
return;
if (player == NULL || !player->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(player);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiTransferBox*> box = NULL;
box = new SuiTransferBox(creature, 0x00);
if(optionsAddFrom.isValidTable()){
String optionAddFromTextString = optionsAddFrom.getStringAt(1);
String optionAddFromStartingString = optionsAddFrom.getStringAt(2);
String optionAddFromRatioString = optionsAddFrom.getStringAt(3);
box->addFrom(optionAddFromTextString,
optionAddFromStartingString,
optionAddFromStartingString, optionAddFromRatioString);
optionsAddFrom.pop();
}
if(optionsAddTo.isValidTable()){
String optionAddToTextString = optionsAddTo.getStringAt(1);
String optionAddToStartingString = optionsAddTo.getStringAt(2);
String optionAddToRatioString = optionsAddTo.getStringAt(3);
box->addTo(optionAddToTextString,
optionAddToStartingString,
optionAddToStartingString, optionAddToRatioString);
optionsAddTo.pop();
}
box->setCallback(new LuaSuiCallback(creature->getZoneServer(), screenplay, callback));
box->setPromptTitle(title);
box->setPromptText(text);
box->setUsingObject(usingObject);
box->setForceCloseDistance(32.f);
creature->sendMessage(box->generateMessage());
playerObject->addSuiBox(box);
}
}
示例11: sendKeypadSui
void SuiManager::sendKeypadSui(SceneObject* keypad, SceneObject* creatureSceneObject, const String& play, const String& callback) {
if (keypad == NULL)
return;
if (creatureSceneObject == NULL || !creatureSceneObject->isCreatureObject())
return;
CreatureObject* creature = cast<CreatureObject*>(creatureSceneObject);
PlayerObject* playerObject = creature->getPlayerObject();
if (playerObject != NULL) {
ManagedReference<SuiKeypadBox*> keypadSui = new SuiKeypadBox(creature, 0x00);
keypadSui->setCallback(new LuaSuiCallback(creature->getZoneServer(), play, callback));
keypadSui->setUsingObject(keypad);
keypadSui->setForceCloseDisabled();
creature->sendMessage(keypadSui->generateMessage());
playerObject->addSuiBox(keypadSui);
}
}
示例12: handleCharacterBuilderSelectItem
void SuiManager::handleCharacterBuilderSelectItem(CreatureObject* player, SuiBox* suiBox, uint32 cancel, Vector<UnicodeString>* args) {
ZoneServer* zserv = player->getZoneServer();
if (args->size() < 1)
return;
bool otherPressed = false;
int index = 0;
if(args->size() > 1) {
otherPressed = Bool::valueOf(args->get(0).toString());
index = Integer::valueOf(args->get(1).toString());
} else {
index = Integer::valueOf(args->get(0).toString());
}
if (!suiBox->isCharacterBuilderBox())
return;
ManagedReference<SuiCharacterBuilderBox*> cbSui = cast<SuiCharacterBuilderBox*>( suiBox);
CharacterBuilderMenuNode* currentNode = cbSui->getCurrentNode();
PlayerObject* ghost = player->getPlayerObject();
//If cancel was pressed then we kill the box/menu.
if (cancel != 0)
return;
//Back was pressed. Send the node above it.
if (otherPressed) {
CharacterBuilderMenuNode* parentNode = currentNode->getParentNode();
if(parentNode == NULL)
return;
cbSui->setCurrentNode(parentNode);
ghost->addSuiBox(cbSui);
player->sendMessage(cbSui->generateMessage());
return;
}
CharacterBuilderMenuNode* node = currentNode->getChildNodeAt(index);
//Node doesn't exist or the index was out of bounds. Should probably resend the menu here.
if (node == NULL) {
ghost->addSuiBox(cbSui);
player->sendMessage(cbSui->generateMessage());
return;
}
if (node->hasChildNodes()) {
//If it has child nodes, display them.
cbSui->setCurrentNode(node);
ghost->addSuiBox(cbSui);
player->sendMessage(cbSui->generateMessage());
} else {
String templatePath = node->getTemplatePath();
if (templatePath.indexOf(".iff") < 0) { // Non-item selections
if (templatePath == "unlearn_all_skills") {
SkillManager::instance()->surrenderAllSkills(player);
player->sendSystemMessage("All skills unlearned.");
} else if (templatePath == "cleanse_character") {
if (!player->isInCombat()) {
player->sendSystemMessage("You have been cleansed from the signs of previous battles.");
for (int i = 0; i < 9; ++i) {
player->setWounds(i, 0);
}
player->setShockWounds(0);
} else {
player->sendSystemMessage("Not within combat.");
}
} else if (templatePath == "reset_buffs") {
if (!player->isInCombat()) {
player->sendSystemMessage("Your buffs have been reset.");
player->clearBuffs(true);
ghost->setFoodFilling(0);
ghost->setDrinkFilling(0);
} else {
player->sendSystemMessage("Not within combat.");
}
} else if (templatePath.beginsWith("crafting_apron_")) {
//"object/tangible/wearables/apron/apron_chef_s01.iff"
//"object/tangible/wearables/ithorian/apron_chef_jacket_s01_ith.iff"
//.........这里部分代码省略.........
示例13: handleObjectMenuSelect
int CoaEncodedDiskMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) {
if (!player->isPlayerCreature()) {
return 0;
}
SceneObject* inventory = player->getSlottedObject("inventory");
if (inventory == NULL) {
return 0;
}
if (!inventory->hasObjectInContainer(sceneObject->getObjectID())) {
player->sendSystemMessage("@encoded_disk/message_fragment:sys_not_in_inv"); // The disk can't be used unless it is in your inventory!
return 0;
}
TangibleObject* disk = cast<TangibleObject*>(sceneObject);
if (disk == NULL) {
return 0;
}
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL) {
return 0;
}
String faction = getFaction(disk);
if (faction.isEmpty()) {
return 0;
}
bool decoded = isDecoded(disk);
if (selectedID == 20) {
String file = "@theme_park/alderaan/act2/" + faction + "_missions";
String title, body;
if (faction == "imperial") {
title = file + ":disk_title";
body = file + ":disk_text";
} else if (faction == "rebel" && decoded) {
title = file + ":disk_decoded_title";
body = file + ":disk_decoded_text";
} else {
title = file + ":disk_encoded_title";
body = file + ":disk_encoded_text";
}
ManagedReference<SuiMessageBox*> box = new SuiMessageBox(player, 0);
box->setPromptTitle(title);
box->setPromptText(body);
box->setUsingObject(disk);
box->setOkButton(true, "@theme_park/alderaan/act2/shared_" + faction + "_missions:close"); // Close
ghost->addSuiBox(box);
player->sendMessage(box->generateMessage());
return 0;
} else if (selectedID == 68) {
if (faction != "rebel") {
return 0;
}
String file = "@theme_park/alderaan/act2/shared_" + faction + "_missions";
uint32 decoderCRC = STRING_HASHCODE("object/tangible/encoded_disk/dead_eye_decoder.iff");
bool hasDecoder = false;
for (int i=0; i< inventory->getContainerObjectsSize(); i++) {
SceneObject* sco = inventory->getContainerObject(i);
if (sco->getServerObjectCRC() == decoderCRC) {
hasDecoder = true;
break;
}
}
if (hasDecoder) {
String key = "disk_name_decoded";
StringId stringid("theme_park/alderaan/act2/shared_rebel_missions", key);
Locker locker(disk);
disk->setObjectName(stringid, true);
player->sendSystemMessage(file + ":decoded_data_disk"); // Using the old Imperial Decoder you were able to decode the Dead Eye message.
return 0;
} else {
player->sendSystemMessage(file + ":decode_failed"); // You do not have the required decoder to decode this message.
return 0;
}
}
return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
示例14: growPet
bool PetControlDeviceImplementation::growPet(CreatureObject* player, bool force, bool adult) {
if (petType != PetManager::CREATUREPET)
return true;
if (growthStage <= 0 || growthStage >= 10)
return true;
ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
if (controlledObject == NULL || !controlledObject->isCreature())
return true;
ManagedReference<Creature*> pet = cast<Creature*>(controlledObject.get());
ManagedReference<CreatureTemplate*> creatureTemplate = pet->getCreatureTemplate();
if (creatureTemplate == NULL)
return true;
PetManager* petManager = pet->getZoneServer()->getPetManager();
if (petManager == NULL)
return true;
Time currentTime;
uint32 timeDelta = currentTime.getTime() - lastGrowth.getTime();
int stagesToGrow = timeDelta / 43200; // 12 hour
if (adult)
stagesToGrow = 10;
if (stagesToGrow == 0 && !force)
return true;
int newStage = growthStage + stagesToGrow;
if (newStage > 10)
newStage = 10;
float newLevel = ((float)pet->getAdultLevel() / 10.0) * (float)newStage;
if (newLevel < 1)
newLevel = 1;
float newHeight = creatureTemplate->getScale() * (0.46 + ((float)newStage * 0.06));
short preEligibility = petManager->checkMountEligibility(_this.getReferenceUnsafeStaticCast());
short postEligibility = petManager->checkMountEligibility(_this.getReferenceUnsafeStaticCast(), newHeight);
assert(pet->isLockedByCurrentThread());
if (preEligibility == PetManager::CANBEMOUNTTRAINED && postEligibility == PetManager::TOOLARGE && !force) {
if (isTrainedAsMount()) {
arrestGrowth();
return true;
}
PlayerObject* ghost = player->getPlayerObject();
if (ghost == NULL){
return true;
}
ManagedReference<SuiListBox*> box = new SuiListBox(player, SuiWindowType::MOUNT_GROWTH_ARREST);
box->setPromptTitle("@pet/pet_menu:mount_growth_title"); // Pet Growth Arrest
box->setPromptText("@pet/pet_menu:mount_growth_prompt"); // Your pet could be trained as a mount, but is about to grow too large to serve as one. If you ever plan on training this pet as a mount you must arrest it's growth now. Stop pet's growth?
box->setUsingObject(_this.getReferenceUnsafeStaticCast());
box->setCancelButton(true, "@cancel");
box->setOkButton(true, "@yes");
box->setOtherButton(true, "@no");
box->setCallback(new MountGrowthArrestSuiCallback(player->getZoneServer(), _this.getReferenceUnsafeStaticCast()));
ghost->addSuiBox(box);
player->sendMessage(box->generateMessage());
return false;
}
if (adult)
pet->setHeight(newHeight, true);
else
pet->setHeight(newHeight, false);
pet->setPetLevel(newLevel);
growthStage = newStage;
lastGrowth.updateToCurrentTime();
setVitality(getVitality());
return true;
}