本文整理汇总了C#中NetworkClient.OutActionLogMessage方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkClient.OutActionLogMessage方法的具体用法?C# NetworkClient.OutActionLogMessage怎么用?C# NetworkClient.OutActionLogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkClient
的用法示例。
在下文中一共展示了NetworkClient.OutActionLogMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessGroupPagesFull
private void ProcessGroupPagesFull(NetworkClient networkClient, GameClient client,
string locationIdent, bool isAuction, IEnumerable<KeyValuePair<string, string>> fullList)
{
//For all items groups...
foreach (KeyValuePair<string, string> item in fullList)
{
//Get group ID
string groupId = item.Key;
//Ignore for shopping?
GameItemsGroup group = _gameItemsGroups[groupId];
if (group == null || group.IgnoreForShopping)
{
continue;
}
//If number of items is more than 0
if (int.Parse(item.Value) > 0)
{
DateTime startTime = DateTime.Now;
string groupName = group.Name;
int subGroupsCount = group.SubGroupsCount;
List<string> subGroupsOrderList = new List<string>();
//Get cached group page ident
string cachedGroupPageIdent = GetCachedGroupPageIdent(locationIdent, groupId);
//Get cached group pages
List<Packet> cachedGroupPages;
if (!_cachedGroupPages.ContainsKey(cachedGroupPageIdent))
{
cachedGroupPages = new List<Packet>();
_cachedGroupPages.Add(cachedGroupPageIdent, cachedGroupPages);
}
else
{
cachedGroupPages = _cachedGroupPages[cachedGroupPageIdent];
}
//There is one page available at least
int pagesCount = 1;
//For each page of group
for (int groupPage = 0; groupPage < pagesCount; groupPage++)
{
//Query page[i] of group
//Query params: 1: group ID, 2: filter, 3: page number, 4: is auction?
string getGroupPagesList = Packet.BuildPacket(FromClient.SHOP,
Shop.ITEMS_GET_LIST, groupId, string.Empty, groupPage,
isAuction);
networkClient.SendData(getGroupPagesList);
//Get group page
Packet groups = networkClient.InputQueue.Pop(FromServer.SHOP_DATA);
if (groups != null)
{
//Calculate pages count
if (groupPage == 0)
{
int cnt = int.Parse(groups["@m"]);
pagesCount = cnt / 8 + (cnt % 8 > 0 ? 1 : 0);
}
//Process items list
ProcessSubGroupsList(networkClient, client, groupId, groupPage, isAuction,
groups, subGroupsOrderList);
//Store cached group page
cachedGroupPages.Add(groups);
}
}
//Reorder subgroups
group.ReorderSubGroups(subGroupsOrderList);
//Out action message
string endTime = DateTime.Now.Subtract(startTime).ToString();
string message = string.Format("'{0}' processed. Subgroups count: {1}, duration: {2}",
groupName, subGroupsCount, Helper.RemoveMilliseconds(endTime));
networkClient.OutActionLogMessage(this, message);
}
}
}
示例2: DoStep
public bool DoStep(NetworkClient networkClient, GameClient client)
{
if (IsReadyForAction)
{
_gameItemsGroups = Instance.GameItemsGroups;
DateTime startShoppingTime = DateTime.Now;
//Refresh list of items owners
_listOfItemsOwners.Refresh();
//Refresh list of purchased items with their owners
_listOfPurchasedItemsWithOwners.Refresh();
//Check full update requirement
bool fullUpdate = _prewFullUpdateTime == 0 ||
Environment.TickCount - _prewFullUpdateTime >= SHOPPING_FULL_UPDATE_MIN * 60000;
//Get location ident
string locationIdent = Helper.GetCurrentLocationIdent(client);
//Check on shop
bool isShop = Locations.Shops.Contains(locationIdent);
//Check on auction
bool isAuction = Locations.Auctions.Contains(locationIdent);
//Out action message
string message = string.Format(@"started, {0}
• in a shop: {1}
• is it an auction: {2}
• full update: {3}
", DateTime.Now,
isShop ? "YES" : "NO",
isAuction ? "YES" : "NO",
fullUpdate ? "YES" : "NO").TrimEnd();
networkClient.OutActionLogMessage(this, message);
//Current location must be a shop, check it
if (isShop)
{
//Make a little shopping :)
DoShopping(networkClient, client, locationIdent, isAuction, fullUpdate);
}
else
{
//Out action message
message = "You are not inside a shop. Shopping unavailable.";
networkClient.OutActionLogMessage(this, message);
}
//Store last time of full update
_prewShoppingnTime = Environment.TickCount;
if (fullUpdate)
{
_prewFullUpdateTime = _prewShoppingnTime;
}
//Out action message
string shoppingTime = DateTime.Now.Subtract(startShoppingTime).ToString();
message = string.Format("completed. Duration: {0}", Helper.RemoveMilliseconds(shoppingTime));
networkClient.OutActionLogMessage(this, message);
return true;
}
return false;
}
示例3: ProcessGroupPagesFromCache
private void ProcessGroupPagesFromCache(NetworkClient networkClient, GameClient client,
string locationIdent, bool isAuction, GameItemsGroup gameItemsGroup)
{
string groupId = gameItemsGroup.ID;
string groupName = gameItemsGroup.Name;
int subGroupsCount = gameItemsGroup.SubGroupsCount;
string cachedGroupPageIdent = GetCachedGroupPageIdent(locationIdent, groupId);
//If group pages were cached for the location
if (_cachedGroupPages.ContainsKey(cachedGroupPageIdent))
{
DateTime startTime = DateTime.Now;
//Get cached group pages
List<Packet> cachedGroupPages = _cachedGroupPages[cachedGroupPageIdent];
//For each cached page of group
int pagesCount = cachedGroupPages.Count;
for (int groupPage = 0; groupPage < pagesCount; groupPage++)
{
Packet groups = cachedGroupPages[groupPage];
ProcessSubGroupsList(networkClient, client, groupId, groupPage, isAuction,
groups, null);
}
//Out action message
string endTime = DateTime.Now.Subtract(startTime).ToString();
string message = string.Format("'{0}' processed. Subgroups count: {1}, duration: {2}",
groupName, subGroupsCount, Helper.RemoveMilliseconds(endTime));
networkClient.OutActionLogMessage(this, message);
}
}