本文整理汇总了C#中Room.GetRoomItemHandler方法的典型用法代码示例。如果您正苦于以下问题:C# Room.GetRoomItemHandler方法的具体用法?C# Room.GetRoomItemHandler怎么用?C# Room.GetRoomItemHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room.GetRoomItemHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasAllRequiredFurnis
internal bool HasAllRequiredFurnis(Room room)
{
if (room == null)
return false;
return RequiredFurnis.All(furni => room.GetRoomItemHandler().HasFurniByItemName(furni));
}
示例2: LoadItem
internal static WiredLoaderObject LoadItem(RoomItem item, Room room, IQueryAdapter dbClient)
{
InteractionType type = item.GetBaseItem().InteractionType;
List<RoomItem> items = null;
if (NeedsFurnitures(type))
{
dbClient.setQuery("SELECT trigger_item FROM wired_to_item WHERE wired_id = " + item.Id);
DataTable dTable = dbClient.getTable();
RoomItem targetItem;
items = new List<RoomItem>(5);
foreach (DataRow dRows in dTable.Rows)
{
targetItem = room.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
if (targetItem == null || items.Contains(targetItem))
{
continue;
}
items.Add(targetItem);
}
}
string[] settings = null;
if(HasSettings(type))
{
settings = new string[4];
dbClient.setQuery("SELECT data_one, data_two,data_three, data_four FROM wired_data WHERE wired_id = " + item.Id);
DataRow dRow = dbClient.getRow();
if (dRow != null)
{
for (int i = 0; i < 4; i++)
{
settings[i] = dRow[i].ToString();
}
}
else
{
settings = new string[] { "", "", "", "" };
}
}
Dictionary<uint, OriginalItemLocation> originalPositionList = null;
if (HasOriginalItemLocations(type))
{
originalPositionList = new Dictionary<uint, OriginalItemLocation>(5);
dbClient.setQuery("SELECT item_id, original_x, original_y, rotation, height, extradata FROM wired_original_item_locations WHERE wired_id = " + item.Id);
DataTable dTable = dbClient.getTable();
foreach (DataRow dRows in dTable.Rows)
{
originalPositionList.Add(uint.Parse(dRows[0].ToString()), new OriginalItemLocation(uint.Parse(dRows[0].ToString()), int.Parse(dRows[1].ToString()), int.Parse(dRows[2].ToString()), (double)Convert.ToDecimal(dRows[4]), int.Parse(dRows[3].ToString()), dRows[5].ToString()));
}
}
return new WiredLoaderObject(items, originalPositionList, settings);
}
示例3: LoadFromDatabase
public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
{
dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = " + this.item.Id);
DataTable dTable = dbClient.getTable();
RoomItem targetItem;
foreach (DataRow dRows in dTable.Rows)
{
targetItem = insideRoom.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
if (targetItem == null || this.items.Contains(targetItem))
continue;
this.items.Add(targetItem);
}
}
示例4: LoadFromDatabase
public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
{
dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
dbClient.addParameter("id", (int)this.item.Id);
DataRow dRow = dbClient.getRow();
if (dRow != null)
this.requiredCycles = Convert.ToInt32(dRow[0].ToString());
else
this.requiredCycles = 0;
dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = " + this.item.Id);
DataTable dTable = dbClient.getTable();
RoomItem targetItem;
foreach (DataRow dRows in dTable.Rows)
{
targetItem = insideRoom.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
if (targetItem == null || this.items.Contains(targetItem))
continue;
targetItem.OnUserWalksOnFurni += targetItem_OnUserWalksOnFurni;
this.items.Add(targetItem);
}
}
示例5: LoadFromDatabase
public void LoadFromDatabase(IQueryAdapter dbClient, Room insideRoom)
{
dbClient.setQuery("SELECT trigger_data FROM trigger_item WHERE trigger_id = @id ");
dbClient.addParameter("id", (int)this.item.Id);
this.delay = dbClient.getInteger();
dbClient.setQuery("SELECT triggers_item FROM trigger_in_place WHERE original_trigger = " + this.item.Id);
DataTable dTable = dbClient.getTable();
RoomItem targetItem;
foreach (DataRow dRows in dTable.Rows)
{
targetItem = insideRoom.GetRoomItemHandler().GetItem(Convert.ToUInt32(dRows[0]));
if (targetItem == null || this.items.Contains(targetItem))
continue;
targetItem.itemTriggerEventHandler += delegateFunction;
this.items.Add(targetItem);
}
}
示例6: HandleDefaultSave
internal static void HandleDefaultSave(uint itemID, Room room)
{
RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
if (item == null)
return;
InteractionType type = item.GetBaseItem().InteractionType;
switch (type)
{
case InteractionType.actiongivescore:
{
int points = 0;
int games = 0;
IWiredTrigger action = new GiveScore(games, points, room.GetGameManager(), itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.actionmoverotate:
{
MovementState movement = MovementState.none;
RotationState rotation = RotationState.none;
List<RoomItem> items = new List<RoomItem>();
int delay = 0;
IWiredTrigger action = new MoveRotate(movement, rotation, items, delay, room, room.GetWiredHandler(), itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.actionposreset:
{
List<RoomItem> items = new List<RoomItem>();
int delay = 0;
IWiredTrigger action = new PositionReset(items, delay, room.GetRoomItemHandler(), room.GetWiredHandler(), itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.actionresettimer:
{
List<RoomItem> items = new List<RoomItem>();
int delay = 0;
IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), items, delay, itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.actionshowmessage:
{
string message = string.Empty;
IWiredTrigger action = new ShowMessage(message, room.GetWiredHandler(), itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.actionteleportto:
{
List<RoomItem> items = new List<RoomItem>();
int delay = 0;
IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), items, delay, itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.actiontogglestate:
{
List<RoomItem> items = new List<RoomItem>();
int delay = 0;
IWiredTrigger action = new ToggleItemState(room.GetGameMap(), room.GetWiredHandler(), items, delay, itemID);
HandleTriggerSave(action, room.GetWiredHandler(), room, itemID);
break;
}
case InteractionType.conditionfurnishaveusers:
{
break;
}
case InteractionType.conditionstatepos:
{
break;
}
case InteractionType.conditiontimelessthan:
{
break;
}
case InteractionType.conditiontimemorethan:
//.........这里部分代码省略.........
示例7: HandleTriggerSave
private static void HandleTriggerSave(IWiredTrigger handler, WiredHandler manager, Room room, uint itemID)
{
RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
if (item == null)
return;
item.wiredHandler = handler;
manager.RemoveFurniture(item); //Removes it from le manager just in case there is annything registered allready
manager.AddFurniture(item);
using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
{
handler.SaveToDatabase(dbClient);
}
}
示例8: GetItems
private static List<RoomItem> GetItems(ClientMessage message, Room room, out int itemCount)
{
List<RoomItem> items = new List<RoomItem>();
itemCount = message.PopWiredInt32();
uint itemID;
RoomItem item;
for (int i = 0; i < itemCount; i++)
{
itemID = message.PopWiredUInt();
item = room.GetRoomItemHandler().GetItem(itemID);
if (item != null && !WiredUtillity.TypeIsWired(item.GetBaseItem().InteractionType))
items.Add(item);
}
return items;
}
示例9: HandleConditionSave
internal static void HandleConditionSave(GameClient Session, uint itemID, Room room, ClientMessage clientMessage)
{
// // id, resolveIntParams, resolveStringParam, getStuffIds, resolveStuffSelectionType
RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
if (item == null)
return;
if (item.wiredCondition != null)
{
item.wiredCondition.Dispose();
item.wiredCondition = null;
}
InteractionType type = item.GetBaseItem().InteractionType;
if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos &&
type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan &&
type != InteractionType.conditiontriggeronfurni)
return;
// Parse data
int[] intParams = new int[clientMessage.ReadInt32()];
for (int i = 0; i < intParams.Length; i++)
intParams[i] = clientMessage.ReadInt32();
string stringParam = clientMessage.ReadString();
int furniCount;
List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
int stuffSelectionType = clientMessage.ReadInt32();
IWiredCondition handler = null;
switch (type)
{
case InteractionType.conditionfurnishaveusers:
{
handler = new FurniHasUser(item, items);
break;
}
case InteractionType.conditionstatepos:
{
handler = new FurniStatePosMatch(item, items);
break;
}
case InteractionType.conditiontimelessthan:
{
handler = new LessThanTimer(500, room, item);
break;
}
case InteractionType.conditiontimemorethan:
{
handler = new MoreThanTimer(500, room, item);
break;
}
case InteractionType.conditiontriggeronfurni:
{
handler = new TriggerUserIsOnFurni(item, items);
break;
}
default:
return;
}
item.wiredCondition = handler;
room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item);
using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
{
handler.SaveToDatabase(dbClient);
}
Session.SendMessage(new ServerMessage(Outgoing.SaveWired));
}
示例10: GetFurniItems
private static List<RoomItem> GetFurniItems(ClientMessage Request, Room Room)
{
List<RoomItem> Items = new List<RoomItem>();
int FurniCount = Request.PopWiredInt32();
for (int i = 0; i < FurniCount; i++)
{
RoomItem Item = Room.GetRoomItemHandler().GetItem(Request.PopWiredUInt());
if (Item != null)
{
Items.Add(Item);
}
}
return Items;
}
示例11: GetFurniItems
private static List<RoomItem> GetFurniItems(ClientMessage Request, Room Room)
{
List<RoomItem> list = new List<RoomItem>();
int num = Request.PopWiredInt32();
checked
{
for (int i = 0; i < num; i++)
{
RoomItem item = Room.GetRoomItemHandler().GetItem(Request.PopWiredUInt());
if (item != null)
{
list.Add(item);
}
}
return list;
}
}
示例12: LoadWiredItem
internal static void LoadWiredItem(RoomItem item, Room room, IQueryAdapter dbClient)
{
InteractionType type = item.GetBaseItem().InteractionType;
WiredLoaderObject wiredData = WiredLoaderObject.LoadItem(item, room, dbClient);
switch (type)
{
case InteractionType.actiongivescore:
{
IWiredTrigger action = new GiveScore(0, 0, room.GetGameManager(), item, room.GetWiredHandler());
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actionmoverotate:
{
IWiredTrigger action = new MoveRotate(MovementState.none, RotationState.none,new List<RoomItem>(), 0, room, room.GetWiredHandler(), item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actionposreset:
{
IWiredTrigger action = new PositionReset(new List<RoomItem>(), 0, room.GetRoomItemHandler(), room.GetWiredHandler(), item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actionresettimer:
{
IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), new List<RoomItem>(), 0, item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actionshowmessage:
{
IWiredTrigger action = new ShowMessage(string.Empty, room.GetWiredHandler(), item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actionteleportto:
{
IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), new List<RoomItem>(), 0, item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actiontogglestate:
{
IWiredTrigger action = new ToggleItemState(room.GetGameMap(), room.GetWiredHandler(), new List<RoomItem>(), 0, item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.actionkick:
{
IWiredTrigger action = new Kick(string.Empty, room.GetWiredHandler(), item);
action.LoadFromWiredObject(wiredData);
HandleItemLoad(action, room.GetWiredHandler(), item);
break;
}
case InteractionType.conditionfurnishaveusers:
{
IWiredCondition furniHasUsers = new FurniHasUser(item, new List<RoomItem>(), room.GetWiredHandler());
furniHasUsers.LoadFromWiredObject(wiredData);
HandleConditionLoad(furniHasUsers, item);
break;
}
case InteractionType.conditionhasfurnionfurni:
{
IWiredCondition furniHasUsers = new FurniHasFurni(item, new List<RoomItem>(), room.GetWiredHandler(), false);
furniHasUsers.LoadFromWiredObject(wiredData);
HandleConditionLoad(furniHasUsers, item);
break;
}
case InteractionType.conditionstatepos:
{
IWiredCondition furnistatepos = new FurniStatePosMatch(item, new List<RoomItem>(), room.GetWiredHandler(),false,false,false);
furnistatepos.LoadFromWiredObject(wiredData);
HandleConditionLoad(furnistatepos, item);
break;
}
case InteractionType.conditiontimelessthan:
{
IWiredCondition timeLessThan = new LessThanTimer(0, room, item, room.GetWiredHandler());
timeLessThan.LoadFromWiredObject(wiredData);
HandleConditionLoad(timeLessThan, item);
break;
//.........这里部分代码省略.........
示例13: GetItems
private static List<RoomItem> GetItems(ClientMessage message, Room room)
{
List<RoomItem> items = new List<RoomItem>();
int itemCount = message.ReadInt();
if (itemCount > BaseWiredInteractor.MAX_FURNI_SELECTION)
{
return items;
}
uint itemID;
RoomItem item;
for (int i = 0; i < itemCount; i++)
{
itemID = message.ReadUInt();
item = room.GetRoomItemHandler().GetItem(itemID);
if (item != null /*&& !WiredUtillity.TypeIsWired(item.GetBaseItem().InteractionType)*/)
items.Add(item);
}
return items;
}
示例14: HandleConditionSave
internal static void HandleConditionSave(uint itemID, Room room, ClientMessage clientMessage)
{
RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
if (item == null)
return;
if (item.wiredHandler != null)
{
item.wiredHandler.Dispose();
item.wiredHandler = null;
}
InteractionType type = item.GetBaseItem().InteractionType;
if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos &&
type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan &&
type != InteractionType.conditiontriggeronfurni && type != InteractionType.conditionhasfurnionfurni)
return;
int amountOfBooleanSettings = clientMessage.ReadInt();
if (amountOfBooleanSettings > 3)
return;
int[] booleans = new int[amountOfBooleanSettings];
for (int i = 0; i < amountOfBooleanSettings; i++)
{
booleans[i] = clientMessage.ReadInt();
}
string someString = clientMessage.ReadString();
List<RoomItem> items = null;
if (ConditionPacketBuilder.NeedsFurni(type))
{
items = GetItems(clientMessage, room);
}
else
{
items = new List<RoomItem>();
}
//int furniCount;
IWiredCondition handler = null;
switch (type)
{
case InteractionType.conditionfurnishaveusers:
{
handler = new FurniHasUser(item, items, room.GetWiredHandler());
break;
}
case InteractionType.conditionstatepos:
{
handler = new FurniStatePosMatch(item, items, room.GetWiredHandler(), booleans[0] == 1, booleans[1] == 1, booleans[2] == 1);
break;
}
case InteractionType.conditiontimelessthan:
{
handler = new LessThanTimer(500, room, item, room.GetWiredHandler());
break;
}
case InteractionType.conditiontimemorethan:
{
handler = new MoreThanTimer(500, room, item, room.GetWiredHandler());
break;
}
case InteractionType.conditiontriggeronfurni:
{
handler = new TriggerUserIsOnFurni(item, items, room.GetWiredHandler());
break;
}
case InteractionType.conditionhasfurnionfurni:
{
handler = new FurniHasFurni(item, items, room.GetWiredHandler(), booleans[0] == 1);
break;
}
default:
return;
}
item.wiredCondition = handler;
room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item);
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
WiredSaverHandler.UpdateInDatabase(handler, dbClient);
}
}
示例15: HandleConditionSave
internal static void HandleConditionSave(uint itemID, Room room, ClientMessage clientMessage)
{
RoomItem item = room.GetRoomItemHandler().GetItem(itemID);
if (item == null)
return;
if (item.wiredHandler != null)
{
item.wiredHandler.Dispose();
item.wiredHandler = null;
}
InteractionType type = item.GetBaseItem().InteractionType;
if (type != InteractionType.conditionfurnishaveusers && type != InteractionType.conditionstatepos &&
type != InteractionType.conditiontimelessthan && type != InteractionType.conditiontimemorethan &&
type != InteractionType.conditiontriggeronfurni)
return;
clientMessage.AdvancePointer(1);
bool a = clientMessage.PopWiredBoolean();
bool b = clientMessage.PopWiredBoolean();
bool c = clientMessage.PopWiredBoolean();
clientMessage.AdvancePointer(2);
int furniCount;
List<RoomItem> items = GetItems(clientMessage, room, out furniCount);
IWiredCondition handler = null;
switch (type)
{
case InteractionType.conditionfurnishaveusers:
{
handler = new FurniHasUser(item, items);
break;
}
case InteractionType.conditionstatepos:
{
handler = new FurniStatePosMatch(item, items);
break;
}
case InteractionType.conditiontimelessthan:
{
handler = new LessThanTimer(500, room, item);
break;
}
case InteractionType.conditiontimemorethan:
{
handler = new MoreThanTimer(500, room, item);
break;
}
case InteractionType.conditiontriggeronfurni:
{
handler = new TriggerUserIsOnFurni(item, items);
break;
}
default:
return;
}
item.wiredCondition = handler;
room.GetWiredHandler().conditionHandler.AddOrIgnoreRefferance(item);
using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
{
handler.SaveToDatabase(dbClient);
}
}