Here are the examples of the csharp api System.Collections.Generic.List.Remove(uint) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
55 Examples
19
Source : BaseCursor.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public virtual void OnSourceLost(SourceStateEventData eventData)
{
if (IsPointerValid && eventData.Controller != null)
{
for (int i = 0; i < eventData.InputSource.Pointers.Length; i++)
{
// If a source is lost that's using this cursor's pointer, we decrement the count to set the cursor state properly.
if (eventData.InputSource.Pointers[i].PointerId == Pointer.PointerId)
{
visibleSourcesCount--;
break;
}
}
}
SourceDownIds.Remove(eventData.SourceId);
if (!IsSourceDetected && SetVisibilityOnSourceDetected)
{
SetVisibility(false);
}
}
19
Source : BaseCursor.cs
with Apache License 2.0
from abist-co-ltd
with Apache License 2.0
from abist-co-ltd
public virtual void OnPointerUp(MixedRealityPointerEventData eventData)
{
if (IsPointerValid)
{
foreach (var sourcePointer in eventData.InputSource.Pointers)
{
if (sourcePointer.PointerId == Pointer.PointerId)
{
SourceDownIds.Remove(eventData.SourceId);
return;
}
}
}
}
19
Source : AgoraServiceImplementation.cs
with MIT License
from AgoraIO-Community
with MIT License
from AgoraIO-Community
internal void OnUserOffline(int uid, int reason)
{
var id = (uint)uid;
_knownStreams.Remove(id);
var toClear = _containers.Where(a => a.StreamUID == id && a.IsStatic).ToList();
var toRemove = _containers.Where(a => a.StreamUID == id && !a.IsStatic).ToList();
global::Android.App.Application.SynchronizationContext.Post(_ =>
{
foreach (var container in toRemove)
{
container.NativeView.RemoveAllViews();
_containers.Remove(container);
}
}, null);
foreach (var container in toClear)
{
container.VideoView.IsOffline = true;
container.VideoView.IsAudioMuted = false;
container.VideoView.IsVideoMuted = false;
container.VideoView.StreamUID = container.VideoView.StreamUID == AgoraService.UnknownLocalStreamId ? AgoraService.UnknownLocalStreamId : AgoraService.UnknownRemoteStreamId;
}
OnDisconnected(id);
}
19
Source : ProgressProcessor.cs
with GNU General Public License v3.0
from audiamus
with GNU General Public License v3.0
from audiamus
private static void processItems (List<uint> items, ProgressEntry<uint> entry) {
if (entry?.Content is null)
return;
uint itm = entry.Content;
if (entry.Cancel) {
items.Remove (itm);
return;
}
items.Add (itm);
items.Sort ();
}
19
Source : AStar.cs
with MIT License
from BrunoSilvaFreire
with MIT License
from BrunoSilvaFreire
public static List<uint> CalculatePath(
uint @from,
uint to,
KuroiLinkMap linkMap
) {
var navMesh = linkMap.NavMesh;
// The set of nodes already evaluated.
var closedSet = new List<uint>();
// The set of currently discovered nodes that are not evaluated yet.
// Initially, only the start node is known.
var openSet = new List<uint> {
from
};
// For each node, which node it can most efficiently be reached from.
// If a node can be reached from many nodes, cameFrom will eventually contain the
// most efficient previous step.
var cameFrom = new Dictionary<uint, uint>();
var gScore = new Dictionary<uint, float> {
[from] = 0.0f
};
// For each node, the total cost of getting from the start node to the goal
// by preplaceding by that node. That value is partly known, partly heuristic.
var fScore = new Dictionary<uint, float>();
fScore[from] = Distance(from, to, navMesh);
while (!openSet.IsEmpty()) {
// the node in openSet having the lowest fScore[] value
var current = openSet.MinBy(node => fScore.GetOrPut(node, () => float.PositiveInfinity));
if (current == to) {
return Reconstruct(cameFrom, current, navMesh);
}
openSet.Remove(current);
closedSet.Add(current);
foreach (var link in linkMap.nodes[current].Links) {
if (!CanTransverse(navMesh, link)) {
continue;
}
var neighbor = link.Destination;
if (closedSet.Contains(neighbor)) {
// Ignore the neighbor which is already evaluated.
continue;
}
var currentGScore = gScore.GetOrPut(current, () => float.PositiveInfinity);
var neightborGScore = gScore.GetOrPut(neighbor, () => float.PositiveInfinity);
var linkDistance = link.CalculateCost(linkMap);
// The distance from start to a neighbor
var tentativeGScore = currentGScore + linkDistance;
if (!openSet.Contains(neighbor)) {
openSet.Add(neighbor);
} else if (tentativeGScore >= neightborGScore) {
// This is not a better path.
continue;
}
// This path is the best until now. Record it!
cameFrom[neighbor] = current;
gScore[neighbor] = tentativeGScore;
fScore[neighbor] = gScore[neighbor] + Distance(neighbor, to, navMesh);
}
}
Debug.LogWarning($"Unable to find path from {@from} to {to}");
return null;
}
19
Source : BattleGroundManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public void Update(uint diff)
{
m_UpdateTimer += diff;
if (m_UpdateTimer > 1000)
{
foreach (var data in bgDataStore.Values)
{
var bgs = data.m_Battlegrounds;
// first one is template and should not be deleted
foreach (var pair in bgs.ToList())
{
Battleground bg = pair.Value;
bg.Update(m_UpdateTimer);
if (bg.ToBeDeleted())
{
bgs.Remove(pair.Key);
var clients = data.m_ClientBattlegroundIds[(int)bg.GetBracketId()];
if (!clients.Empty())
clients.Remove(bg.GetClientInstanceID());
bg.Dispose();
}
}
}
m_UpdateTimer = 0;
}
// update events timer
foreach (var pair in m_BattlegroundQueues)
pair.Value.UpdateEvents(diff);
// update scheduled queues
if (!m_QueueUpdateScheduler.Empty())
{
List<ScheduledQueueUpdate> scheduled = new();
Extensions.Swap(ref scheduled, ref m_QueueUpdateScheduler);
for (byte i = 0; i < scheduled.Count; i++)
{
uint arenaMMRating = scheduled[i].ArenaMatchmakerRating;
BattlegroundQueueTypeId bgQueueTypeId = scheduled[i].QueueId;
BattlegroundBracketId bracket_id = scheduled[i].BracketId;
GetBattlegroundQueue(bgQueueTypeId).BattlegroundQueueUpdate(diff, bracket_id, arenaMMRating);
}
}
// if rating difference counts, maybe force-update queues
if (WorldConfig.GetIntValue(WorldCfg.ArenaMaxRatingDifference) != 0 && WorldConfig.GetIntValue(WorldCfg.ArenaRatedUpdateTimer) != 0)
{
// it's time to force update
if (m_NextRatedArenaUpdate < diff)
{
// forced update for rated arenas (scan all, but skipped non rated)
Log.outDebug(LogFilter.Arena, "BattlegroundMgr: UPDATING ARENA QUEUES");
foreach (ArenaTypes teamSize in new[] { ArenaTypes.Team2v2, ArenaTypes.Team3v3, ArenaTypes.Team5v5 })
{
BattlegroundQueueTypeId ratedArenaQueueId = BGQueueTypeId((ushort)BattlegroundTypeId.AA, BattlegroundQueueIdType.Arena, true, teamSize);
for (var bracket = BattlegroundBracketId.First; bracket < BattlegroundBracketId.Max; ++bracket)
GetBattlegroundQueue(ratedArenaQueueId).BattlegroundQueueUpdate(diff, bracket, 0);
}
m_NextRatedArenaUpdate = WorldConfig.GetUIntValue(WorldCfg.ArenaRatedUpdateTimer);
}
else
m_NextRatedArenaUpdate -= diff;
}
}
19
Source : RoleAccessControl.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
void RemoveGrantedPermission(uint permissionId)
{
_grantedPerms.Remove(permissionId);
}
19
Source : RoleAccessControl.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
void RemoveDeniedPermission(uint permissionId)
{
_deniedPerms.Remove(permissionId);
}
19
Source : RoleAccessControl.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public void RemoveLinkedPermission(uint id) { _perms.Remove(id); }
19
Source : RoleAccessControl.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
void RemovePermissions(List<uint> permsFrom, List<uint> permsToRemove)
{
foreach (var id in permsToRemove)
permsFrom.Remove(id);
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Disenchant()
{
Log.outInfo(LogFilter.ServerLoading, "Loading disenchanting loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet, lootIdSetUsed = new();
uint count = Disenchant.LoadAndCollectLootIds(out lootIdSet);
foreach (var disenchant in CliDB.ItemDisenchantLootStorage.Values)
{
uint lootid = disenchant.Id;
if (!lootIdSet.Contains(lootid))
Disenchant.ReportNonExistingId(lootid, disenchant.Id);
else
lootIdSetUsed.Add(lootid);
}
foreach (var id in lootIdSetUsed)
lootIdSet.Remove(id);
// output error for any still listed (not referenced from appropriate table) ids
Disenchant.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} disenchanting loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public void CheckLootRefs(LootTemplateMap store, List<uint> ref_set)
{
foreach (var item in ExplicitlyChanced)
{
if (item.reference > 0)
{
if (LootStorage.Reference.GetLootFor(item.reference) == null)
LootStorage.Reference.ReportNonExistingId(item.reference, item.itemid);
else if (ref_set != null)
ref_set.Remove(item.reference);
}
}
foreach (var item in EqualChanced)
{
if (item.reference > 0)
{
if (LootStorage.Reference.GetLootFor(item.reference) == null)
LootStorage.Reference.ReportNonExistingId(item.reference, item.itemid);
else if (ref_set != null)
ref_set.Remove(item.reference);
}
}
}
19
Source : InstanceScript.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public void ResetAreaTriggerDone(uint id) { _activatedAreaTriggers.Remove(id); }
19
Source : Garrisons.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
void UnlearnBlueprint(uint garrBuildingId)
{
GarrisonUnlearnBlueprintResult unlearnBlueprintResult = new();
unlearnBlueprintResult.GarrTypeID = GetGarrisonType();
unlearnBlueprintResult.BuildingID = garrBuildingId;
unlearnBlueprintResult.Result = GarrisonError.Success;
if (!CliDB.GarrBuildingStorage.ContainsKey(garrBuildingId))
unlearnBlueprintResult.Result = GarrisonError.InvalidBuildingId;
else if (HasBlueprint(garrBuildingId))
unlearnBlueprintResult.Result = GarrisonError.RequiresBlueprint;
else
_knownBuildings.Remove(garrBuildingId);
_owner.SendPacket(unlearnBlueprintResult);
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Pickpocketing()
{
Log.outInfo(LogFilter.ServerLoading, "Loading pickpocketing loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
List<uint> lootIdSetUsed = new();
uint count = Pickpocketing.LoadAndCollectLootIds(out lootIdSet);
// Remove real entries and check loot existence
var ctc = Global.ObjectMgr.GetCreatureTemplates();
foreach (var pair in ctc)
{
uint lootid = pair.Value.PickPocketId;
if (lootid != 0)
{
if (!lootIdSet.Contains(lootid))
Pickpocketing.ReportNonExistingId(lootid, pair.Value.Entry);
else
lootIdSetUsed.Add(lootid);
}
}
foreach (var id in lootIdSetUsed)
lootIdSet.Remove(id);
// output error for any still listed (not referenced from appropriate table) ids
Pickpocketing.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} pickpocketing loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Fishing()
{
Log.outInfo(LogFilter.ServerLoading, "Loading fishing loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
uint count = Fishing.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
foreach (var areaEntry in CliDB.AreaTableStorage.Values)
if (lootIdSet.Contains(areaEntry.Id))
lootIdSet.Remove(areaEntry.Id);
// output error for any still listed (not referenced from appropriate table) ids
Fishing.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} fishing loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Gameobject()
{
Log.outInfo(LogFilter.ServerLoading, "Loading gameobject loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet, lootIdSetUsed = new();
uint count = Gameobject.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
var gotc = Global.ObjectMgr.GetGameObjectTemplates();
foreach (var go in gotc)
{
uint lootid = go.Value.GetLootId();
if (lootid != 0)
{
if (!lootIdSet.Contains(lootid))
Gameobject.ReportNonExistingId(lootid, go.Value.entry);
else
lootIdSetUsed.Add(lootid);
}
}
foreach (var id in lootIdSetUsed)
lootIdSet.Remove(id);
// output error for any still listed (not referenced from appropriate table) ids
Gameobject.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} gameobject loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Item()
{
Log.outInfo(LogFilter.ServerLoading, "Loading item loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
uint count = Items.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
var its = Global.ObjectMgr.GereplacedemTemplates();
foreach (var pair in its)
if (lootIdSet.Contains(pair.Value.GetId()) && pair.Value.GetFlags().HasAnyFlag(ItemFlags.HasLoot))
lootIdSet.Remove(pair.Value.GetId());
// output error for any still listed (not referenced from appropriate table) ids
Items.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} item loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 item loot templates. DB table `item_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Milling()
{
Log.outInfo(LogFilter.ServerLoading, "Loading milling loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
uint count = Milling.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
var its = Global.ObjectMgr.GereplacedemTemplates();
foreach (var pair in its)
{
if (!pair.Value.GetFlags().HasAnyFlag(ItemFlags.IsMillable))
continue;
if (lootIdSet.Contains(pair.Value.GetId()))
lootIdSet.Remove(pair.Value.GetId());
}
// output error for any still listed (not referenced from appropriate table) ids
Milling.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} milling loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public void CheckLootRefs(LootTemplateMap store, List<uint> ref_set)
{
foreach (var item in Entries)
{
if (item.reference > 0)
{
if (LootStorage.Reference.GetLootFor(item.reference) == null)
LootStorage.Reference.ReportNonExistingId(item.reference, item.itemid);
else if (ref_set != null)
ref_set.Remove(item.reference);
}
}
foreach (var group in Groups.Values)
group.CheckLootRefs(store, ref_set);
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Creature()
{
Log.outInfo(LogFilter.ServerLoading, "Loading creature loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet, lootIdSetUsed = new();
uint count = Creature.LoadAndCollectLootIds(out lootIdSet);
// Remove real entries and check loot existence
var ctc = Global.ObjectMgr.GetCreatureTemplates();
foreach (var pair in ctc)
{
uint lootid = pair.Value.LootId;
if (lootid != 0)
{
if (!lootIdSet.Contains(lootid))
Creature.ReportNonExistingId(lootid, pair.Value.Entry);
else
lootIdSetUsed.Add(lootid);
}
}
foreach (var id in lootIdSetUsed)
lootIdSet.Remove(id);
// 1 means loot for player corpse
lootIdSet.Remove(SharedConst.PlayerCorpseLootEntry);
// output error for any still listed (not referenced from appropriate table) ids
Creature.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Creature()
{
Log.outInfo(LogFilter.ServerLoading, "Loading creature loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet, lootIdSetUsed = new();
uint count = Creature.LoadAndCollectLootIds(out lootIdSet);
// Remove real entries and check loot existence
var ctc = Global.ObjectMgr.GetCreatureTemplates();
foreach (var pair in ctc)
{
uint lootid = pair.Value.LootId;
if (lootid != 0)
{
if (!lootIdSet.Contains(lootid))
Creature.ReportNonExistingId(lootid, pair.Value.Entry);
else
lootIdSetUsed.Add(lootid);
}
}
foreach (var id in lootIdSetUsed)
lootIdSet.Remove(id);
// 1 means loot for player corpse
lootIdSet.Remove(SharedConst.PlayerCorpseLootEntry);
// output error for any still listed (not referenced from appropriate table) ids
Creature.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Prospecting()
{
Log.outInfo(LogFilter.ServerLoading, "Loading prospecting loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
uint count = Prospecting.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
var its = Global.ObjectMgr.GereplacedemTemplates();
foreach (var pair in its)
{
if (!pair.Value.GetFlags().HasAnyFlag(ItemFlags.IsProspectable))
continue;
if (lootIdSet.Contains(pair.Value.GetId()))
lootIdSet.Remove(pair.Value.GetId());
}
// output error for any still listed (not referenced from appropriate table) ids
Prospecting.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} prospecting loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Mail()
{
Log.outInfo(LogFilter.ServerLoading, "Loading mail loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
uint count = Mail.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
foreach (var mail in CliDB.MailTemplateStorage.Values)
if (lootIdSet.Contains(mail.Id))
lootIdSet.Remove(mail.Id);
// output error for any still listed (not referenced from appropriate table) ids
Mail.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} mail loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Skinning()
{
Log.outInfo(LogFilter.ServerLoading, "Loading skinning loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
List<uint> lootIdSetUsed = new();
uint count = Skinning.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
var ctc = Global.ObjectMgr.GetCreatureTemplates();
foreach (var pair in ctc)
{
uint lootid = pair.Value.SkinLootId;
if (lootid != 0)
{
if (!lootIdSet.Contains(lootid))
Skinning.ReportNonExistingId(lootid, pair.Value.Entry);
else
lootIdSetUsed.Add(lootid);
}
}
foreach (var id in lootIdSetUsed)
lootIdSet.Remove(id);
// output error for any still listed (not referenced from appropriate table) ids
Skinning.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} skinning loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
}
19
Source : LootManager.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static void LoadLootTemplates_Spell()
{
// TODO: change this to use MiscValue from spell effect as id instead of spell id
Log.outInfo(LogFilter.ServerLoading, "Loading spell loot templates...");
uint oldMSTime = Time.GetMSTime();
List<uint> lootIdSet;
uint count = Spell.LoadAndCollectLootIds(out lootIdSet);
// remove real entries and check existence loot
foreach (SpellNameRecord spellNameEntry in CliDB.SpellNameStorage.Values)
{
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellNameEntry.Id, Difficulty.None);
if (spellInfo == null)
continue;
// possible cases
if (!spellInfo.IsLootCrafting())
continue;
if (!lootIdSet.Contains(spellInfo.Id))
{
// not report about not trainable spells (optionally supported by DB)
// ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
if (!spellInfo.HasAttribute(SpellAttr0.NotShapeshift) || spellInfo.HasAttribute(SpellAttr0.Tradespell))
{
Spell.ReportNonExistingId(spellInfo.Id, spellInfo.Id);
}
}
else
lootIdSet.Remove(spellInfo.Id);
}
// output error for any still listed (not referenced from appropriate table) ids
Spell.ReportUnusedIds(lootIdSet);
if (count != 0)
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} spell loot templates in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
else
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
}
19
Source : AgoraServiceImplementation.cs
with MIT License
from DreamTeamMobile
with MIT License
from DreamTeamMobile
internal void OnUserOffline(int uid, int reason)
{
var id = (uint)uid;
_knownStreams.Remove(id);
var toClear = _containers.Where(a => a.StreamUID == id && a.IsStatic).ToList();
var toRemove = _containers.Where(a => a.StreamUID == id && !a.IsStatic).ToList();
global::Android.App.Application.SynchronizationContext.Post(_ =>
{
foreach (var container in toRemove)
{
container.NativeView.RemoveAllViews();
_containers.Remove(container);
}
}, null);
foreach (var container in toClear)
{
container.VideoView.IsOffline = true;
container.VideoView.IsAudioMuted = false;
container.VideoView.IsVideoMuted = false;
container.VideoView.StreamUID = container.VideoView.StreamUID == Consts.UnknownLocalStreamId ? Consts.UnknownLocalStreamId : Consts.UnknownRemoteStreamId;
}
OnDisconnected(id);
}
19
Source : GhostNetRaceManager.cs
with MIT License
from EverestAPI
with MIT License
from EverestAPI
public void RemovePlayer(uint playerID, string message) {
Send(null, message);
lock (Players) {
Players.Remove(playerID);
if (Players.Count == 0) {
Manager.Races[ID] = null;
return;
}
}
}
19
Source : DebugProgram.cs
with Apache License 2.0
from googlestadia
with Apache License 2.0
from googlestadia
public int EnumThreads(out IEnumDebugThreads2 threadsEnum)
{
lock (_threadCache)
{
var remoteThreads = GetRemoteThreads();
// If we fail to get the list of threads, return the current cache instead. If we
// send a ThreadCreateEvent, and then fail to return that thread on the next
// EnumThreads call, that thread will be lost forever.
if (remoteThreads.Count == 0)
{
threadsEnum = _threadEnumFactory.Create(_threadCache.Values);
return VSConstants.S_OK;
}
// Update the thread cache, and remove any stale entries.
var deadIds = _threadCache.Keys.ToList();
foreach (var remoteThread in remoteThreads)
{
var currentThread = GetDebugThread(remoteThread);
uint threadId;
currentThread.GetThreadId(out threadId);
deadIds.Remove(threadId);
}
foreach (var threadId in deadIds)
{
IDebugThread thread;
if (_threadCache.TryGetValue(threadId, out thread))
{
_debugEngineHandler.SendEvent(new ThreadDestroyEvent(0), Self, thread);
_threadCache.Remove(threadId);
}
}
threadsEnum = _threadEnumFactory.Create(_threadCache.Values);
}
return VSConstants.S_OK;
}
19
Source : RenderMaterialsModule.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
private void OnRenderMaterialRemoved(SceneObjectPart part, UUID matID)
{
if (part == null)
return;
lock (m_knownMaterials)
{
if (m_knownMaterials.ContainsKey(matID))
{
m_knownMaterials[matID].partIds.Remove(part.LocalId);
if (m_knownMaterials[matID].partIds.Count <= 0)
{
m_log.DebugFormat("[RenderMaterials]: Removing unused RenderMaterials {0} from region cache.", matID.ToString());
m_knownMaterials.Remove(matID);
}
}
}
}
19
Source : RenderMaterialsModule.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
private void OnObjectRemoved(SceneObjectGroup obj)
{
lock (m_knownMaterials)
{
foreach (SceneObjectPart part in obj.GetParts())
{
// scan through the rendermaterials of this part for any textures used as materials
if ((part.Shape.Textures == null) || (part.Shape.RenderMaterials == null))
continue;
var matIds = part.Shape.GetMaterialIDs();
foreach (var key in matIds)
{
if (m_knownMaterials.ContainsKey(key))
{
var entry = m_knownMaterials[key];
entry.partIds.Remove(part.LocalId);
if (entry.partIds.Count <= 0)
{
m_knownMaterials.Remove(key);
m_log.DebugFormat("[MaterialsModule]: OnObjectRemoved Material {0} not referenced. Removed from cache.", key);
}
}
}
}
}
}
19
Source : ArchiveEditorFunctions_IO.cs
with GNU General Public License v3.0
from igorseabra4
with GNU General Public License v3.0
from igorseabra4
public void ImportHip((HipFile, Game, Platform) hip, bool forceOverwrite, List<uint> missingreplacedets)
{
UnsavedChanges = true;
forceOverwrite |= missingreplacedets != null;
foreach (Section_AHDR AHDR in hip.Item1.DICT.ATOC.AHDRList)
{
if (AHDR.replacedetType == replacedetType.COLL && ContainsreplacedetWithType(replacedetType.COLL))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
MergeCOLL(new replacedetCOLL(AHDR, hip.Item2, hip.Item3.Endianness()));
continue;
}
else if (AHDR.replacedetType == replacedetType.JAW && ContainsreplacedetWithType(replacedetType.JAW))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
MergeJAW(new replacedetJAW(AHDR, hip.Item2, hip.Item3.Endianness()));
continue;
}
else if (AHDR.replacedetType == replacedetType.LODT && ContainsreplacedetWithType(replacedetType.LODT))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
MergeLODT(new replacedetLODT(AHDR, hip.Item2, hip.Item3.Endianness()));
continue;
}
else if (AHDR.replacedetType == replacedetType.PIPT && ContainsreplacedetWithType(replacedetType.PIPT))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
MergePIPT(new replacedetPIPT(AHDR, hip.Item2, hip.Item3.Endianness()));
continue;
}
else if (AHDR.replacedetType == replacedetType.SHDW && ContainsreplacedetWithType(replacedetType.SHDW))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
MergeSHDW(new replacedetSHDW(AHDR, hip.Item2, hip.Item3.Endianness()));
continue;
}
else if (AHDR.replacedetType == replacedetType.SNDI && ContainsreplacedetWithType(replacedetType.SNDI))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
if (hip.Item3 == Platform.GameCube)
{
if (hip.Item2 == Game.Incredibles)
MergeSNDI(new replacedetSNDI_GCN_V2(AHDR, hip.Item2, hip.Item3.Endianness()));
else
MergeSNDI(new replacedetSNDI_GCN_V1(AHDR, hip.Item2, hip.Item3.Endianness()));
}
else if (hip.Item3 == Platform.Xbox)
MergeSNDI(new replacedetSNDI_XBOX(AHDR, hip.Item2, hip.Item3.Endianness()));
else if (hip.Item3 == Platform.PS2)
MergeSNDI(new replacedetSNDI_PS2(AHDR, hip.Item2, hip.Item3.Endianness()));
continue;
}
if (missingreplacedets != null && !missingreplacedets.Contains(AHDR.replacedetID))
{
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
continue;
}
if (Containsreplacedet(AHDR.replacedetID) && (missingreplacedets == null || missingreplacedets.Contains(AHDR.replacedetID)))
{
DialogResult result = forceOverwrite ? DialogResult.Yes :
MessageBox.Show($"replacedet [{AHDR.replacedetID.ToString("X8")}] {AHDR.ADBG.replacedetName} already present in archive. Do you wish to overwrite it?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
Removereplacedet(AHDR.replacedetID, false);
AddreplacedetToDictionary(AHDR, hip.Item2, hip.Item3.Endianness(), forceOverwrite, forceOverwrite);
}
else
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
LHDR.replacedetIDlist.Remove(AHDR.replacedetID);
if (missingreplacedets != null)
missingreplacedets.Remove(AHDR.replacedetID);
}
else if (missingreplacedets == null)
{
AddreplacedetToDictionary(AHDR, hip.Item2, hip.Item3.Endianness(), forceOverwrite, forceOverwrite);
}
}
foreach (Section_LHDR LHDR in hip.Item1.DICT.LTOC.LHDRList)
if (LHDR.replacedetIDlist.Count != 0)
DICT.LTOC.LHDRList.Add(LHDR);
DICT.LTOC.LHDRList = DICT.LTOC.LHDRList.OrderBy(f => f.layerType, new LHDRComparer(game)).ToList();
if (!forceOverwrite)
RecalculateAllMatrices();
}
19
Source : RemoteControl.cs
with The Unlicense
from marcussacana
with The Unlicense
from marcussacana
private IntPtr x64Invoke(IntPtr FuncAddr, bool CatchReturn, params IntPtr[] Arguments) {
using (MemoryStream Stream = new MemoryStream()) {
byte[][] Commands = new byte[][] {
//push rbp
new byte [] { 0x55 },
//mov rbp, rsp
new byte[] { 0x48, 0x89, 0xE5 },
//(2 times to keep the stack padding)
//push rbx
new byte[] { 0x53 },
//push rbx
new byte[] { 0x53 }
};
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
uint MinStack = 0x30;
uint StackLen = MinStack;
if (Arguments.Length > 4)
StackLen += ((uint)((Arguments.LongLength - 4) + (Arguments.LongLength % 2))) * 8;
Commands = new byte[][] {
//sub rsp, MinStack
new byte[] { 0x48, 0x81, 0xEC }.Append(MinStack.GetBytes())
};
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
int ID = Arguments.Length;
foreach (IntPtr Argument in Arguments.Reverse()) {
switch (--ID) {
case 0:
Commands = new byte[][] {
//movabs rcx, Argument
new byte[] { 0x48, 0xB9 }.Append(Argument.ToUInt64().GetBytes())
};
break;
case 1:
Commands = new byte[][] {
//movabs rdx, Argument
new byte[] { 0x48, 0xBA }.Append(Argument.ToUInt64().GetBytes())
};
break;
case 2:
Commands = new byte[][] {
//movabs r8, Argument
new byte[] { 0x49, 0xB8 }.Append(Argument.ToUInt64().GetBytes())
};
break;
case 3:
Commands = new byte[][] {
//movabs r9, Argument
new byte[] { 0x49, 0xB9 }.Append(Argument.ToUInt64().GetBytes())
};
break;
default:
Commands = new byte[][] {
//push "4 last bytes from Argument"
new byte[] { 0x68 }.Append(Argument.ToUInt32().GetBytes()),
//mov [rsp+4], "4 frist bytes from Argument"
new byte[] { 0xC7, 0x44, 0x24, 0x04 }.Append(Argument.HighToUInt32().GetBytes())
};
break;
}
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
}
if (Arguments.LongLength % 2 != 0 && Arguments.Length > 4) {
Commands = new byte[][] {
//sub rsp, 0x8
new byte[] { 0x48, 0x81, 0xEC }.Append(0x8.GetBytes())
};
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
}
if (Arguments.Length > 4) {
for (int i = 0; i < 4; i++) {
StackLen += 8;
Commands = new byte[][] {
//push 0x00
new byte[] { 0x6A, 0x00 }
};
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
}
}
Commands = new byte[][] {
//xor rax, rax
new byte[] { 0x48, 0x31, 0xC0 },
//movabs rbx, FuncAddr
new byte[] { 0x48, 0xBB }.Append(FuncAddr.ToUInt64().GetBytes()),
//call rbx
new byte[] { 0xFF, 0xD3 },
//add rsp, DW
new byte[] { 0x48, 0x81, 0xC4 }.Append(StackLen.GetBytes())
};
if (CatchReturn)
Commands = Commands.Append(new byte[][] {
//Call NextInstruction
new byte[] { 0xE8, 0x00, 0x00, 0x00, 0x00 },
//pop rbx
new byte[] { 0x5B },
//mov qword [rbx+0x0E], rax
new byte[] { 0x48, 0x89, 0x43, 0x0E },
//mov byte [rbx+0x0D], 1
new byte[] { 0xC6, 0x43, 0x0D, 0x01 }
});
Commands = Commands.Append(new byte[][] {
//pop rbx
new byte[] { 0x5B },
//pop rbx
new byte[] { 0x5B },
//leave
new byte[] { 0xC9 },
//ret
new byte[] { 0xC3 }
});
if (CatchReturn)
Commands = Commands.Append(new byte[][] {
//RBX+0xD
new byte[] { 0x00 },
//RBX+0xE
new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
});
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
IntPtr Function = Target.MAlloc(Stream.ToArray(), true);
IntPtr hThread = CreateRemoteThread(hProcess, IntPtr.Zero, 0, Function, IntPtr.Zero, 0, IntPtr.Zero);
uint TID = GetThreadId(hThread);
RemoteThreads.Add(TID);
while (ResumeThread(hThread) > 0) {
GetExitCodeThread(hThread, out uint Status);
if (Status != THREAD_STILL_ACTIVE)
break;
Thread.Sleep(10);
}
if (CatchReturn) {
IntPtr RetData = Function.Sum(Stream.Length - 9);
uint Status = 0;
byte[] Buffer = new byte[9];
while (GetExitCodeThread(hThread, out Status)) {
if (Status != THREAD_STILL_ACTIVE)
break;
Thread.Sleep(10);
Buffer = Target.Read(RetData, (uint)Buffer.LongLength);
if (Buffer[0] != 0x1)
continue;
break;
}
do {
GetExitCodeThread(hThread, out Status);
} while (Status == THREAD_STILL_ACTIVE);
RemoteThreads.Remove(TID);
Target.MFree(Function);
return BitConverter.ToUInt64(Buffer, 1).ToIntPtr();
} else
return IntPtr.Zero;
}
}
19
Source : RemoteControl.cs
with The Unlicense
from marcussacana
with The Unlicense
from marcussacana
private IntPtr x32Invoke(IntPtr FuncAddr, bool CatchReturn, params IntPtr[] Arguments) {
using (MemoryStream Stream = new MemoryStream()) {
//Move CreateThread paramter to EAX and fix stack
byte[][] Commands = new byte[][] {
//pop eax
new byte[] { 0x58 },
//xchg [esp], eax
new byte[] { 0x87, 0x04, 0x24 }
};
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
//Push All Arguments
foreach (IntPtr Argument in Arguments.Reverse()) {
Stream.WriteByte(0x68);//Push DW
Stream.Write(BitConverter.GetBytes(Argument.ToInt32()), 0, 4);
}
Commands = new byte[][] {
//mov eax, FuncAddr
new byte[] { 0xB8 }.Append(FuncAddr.ToUInt32().GetBytes()),
//call eax
new byte[] { 0xFF, 0xD0 },
};
if (CatchReturn)
Commands = Commands.Append(new byte[][] {
//push ebx
new byte[] { 0x53 },
//Call NextInstruction
new byte[] { 0xE8, 0x00, 0x00, 0x00, 0x00 },
//pop ebx
new byte[] { 0x5B },
//mov dword [ebx+0xB], eax
new byte[] { 0x89, 0x43, 0x0B },
//mov byte [ebx+0xA], 0x1
new byte[] { 0xC6, 0x43, 0x0A, 0x01 },
//pop ebx
new byte[] { 0x5B }
});
Commands = Commands.Append(new byte[][] {
//ret
new byte[] { 0xC3 }
});
if (CatchReturn)
Commands = Commands.Append(new byte[][] {
//EBX+A
new byte[] { 0x00 },
//EBX+B
new byte[] { 0x00, 0x00, 0x00, 0x00 }
});
foreach (byte[] Command in Commands)
Stream.Write(Command, 0, Command.Length);
IntPtr Function = Target.MAlloc(Stream.ToArray(), true);
IntPtr hThread = CreateRemoteThread(hProcess, IntPtr.Zero, 0, Function, IntPtr.Zero, 0, IntPtr.Zero);
uint TID = GetThreadId(hThread);
RemoteThreads.Add(TID);
while (ResumeThread(hThread) > 0) {
GetExitCodeThread(hThread, out uint Status);
if (Status != THREAD_STILL_ACTIVE)
break;
Thread.Sleep(10);
}
if (CatchReturn) {
IntPtr RetData = Function.Sum(Stream.Length - 5);
uint Status = 0;
byte[] Buffer = new byte[5];
while (true) {
Thread.Sleep(10);
Buffer = Target.Read(RetData, (uint)Buffer.LongLength);
if (Buffer[0] != 0x1) {
GetExitCodeThread(hThread, out Status);
if (Status == THREAD_STILL_ACTIVE)
continue;
else
throw new Exception("An Unmanaged Exception in the target process has occured");
}
break;
}
do {
GetExitCodeThread(hThread, out Status);
} while (Status == THREAD_STILL_ACTIVE);
RemoteThreads.Remove(TID);
Target.MFree(Function);
return BitConverter.ToUInt32(Buffer, 1).ToIntPtr();
} else
return IntPtr.Zero;
}
}
19
Source : GameDataLoader.cs
with MIT License
from MgAl2O4
with MIT License
from MgAl2O4
private bool ParseNpcs(DataManager dataManager)
{
var npcDB = TriadNpcDB.Get();
// cards & rules can be mapped directly from their respective DBs
var cardDB = TriadCardDB.Get();
var modDB = TriadGameModifierDB.Get();
// name is a bit more annoying to get
var listTriadIds = new List<uint>();
var npcDataSheet = dataManager.GetExcelSheet<Lumina.Excel.GeneratedSheets.TripleTriad>();
if (npcDataSheet != null)
{
// rowIds are not going from 0 here!
foreach (var rowData in npcDataSheet)
{
listTriadIds.Add(rowData.RowId);
}
}
listTriadIds.Remove(0);
if (listTriadIds.Count == 0)
{
PluginLog.Fatal("Failed to parse npc data (missing ids)");
return false;
}
var mapTriadNpcData = new Dictionary<uint, NpcIds>();
var sheetNpcNames = dataManager.GetExcelSheet<Lumina.Excel.GeneratedSheets.ENpcResident>();
var sheetENpcBase = dataManager.GetExcelSheet<Lumina.Excel.GeneratedSheets.ENpcBase>();
if (sheetNpcNames != null && sheetENpcBase != null)
{
foreach (var rowData in sheetENpcBase)
{
var triadId = Array.Find(rowData.ENpcData, id => listTriadIds.Contains(id));
if (triadId != 0 && !mapTriadNpcData.ContainsKey(triadId))
{
var rowName = sheetNpcNames.GetRow(rowData.RowId);
if (rowName != null)
{
mapTriadNpcData.Add(triadId, new NpcIds() { ENpcId = rowData.RowId, TriadNpcId = triadId, Name = rowName.Singular.RawString });
}
}
}
}
else
{
PluginLog.Fatal($"Failed to parse npc data (NN:{sheetNpcNames?.RowCount ?? 0}, NB:{sheetENpcBase?.RowCount ?? 0})");
return false;
}
// prep rule id mapping :/
var ruleLuminaToLogicMap = new int[ruleLogicToLuminaMap.Length];
for (int idx = 0; idx < ruleLogicToLuminaMap.Length; idx++)
{
ruleLuminaToLogicMap[ruleLogicToLuminaMap[idx]] = idx;
}
int nameLocId = 0;
foreach (var rowData in npcDataSheet)
{
if (!mapTriadNpcData.ContainsKey(rowData.RowId))
{
// no name = no npc entry, disabled? skip it
continue;
}
var listRules = new List<TriadGameModifier>();
if (rowData.TripleTriadRule != null)
{
foreach (var ruleRow in rowData.TripleTriadRule)
{
if (ruleRow.Row != 0)
{
if (ruleRow.Row >= modDB.mods.Count)
{
PluginLog.Fatal($"Failed to parse npc data (rule.id:{ruleRow.Row})");
return false;
}
var logicRule = modDB.mods[ruleLuminaToLogicMap[(int)ruleRow.Row]];
listRules.Add(logicRule);
if (ruleRow.Value.Name.RawString != logicRule.GetLocalizedName())
{
PluginLog.Fatal($"Failed to match npc rules! (rule.id:{ruleRow.Row})");
return false;
}
}
}
}
int numCardsFixed = 0;
int[] cardsFixed = new int[5];
if (rowData.TripleTriadCardFixed != null)
{
if (rowData.TripleTriadCardFixed.Length != 5)
{
PluginLog.Fatal($"Failed to parse npc data (num CF:{rowData.TripleTriadCardFixed.Length})");
return false;
}
for (int cardIdx = 0; cardIdx < rowData.TripleTriadCardFixed.Length; cardIdx++)
{
var cardRowIdx = rowData.TripleTriadCardFixed[cardIdx].Row;
if (cardRowIdx != 0)
{
if (cardRowIdx >= cardDB.cards.Count)
{
PluginLog.Fatal($"Failed to parse npc data (card.id:{cardRowIdx})");
return false;
}
cardsFixed[cardIdx] = (int)cardRowIdx;
numCardsFixed++;
}
}
}
int numCardsVar = 0;
int[] cardsVariable = new int[5];
if (rowData.TripleTriadCardVariable != null)
{
if (rowData.TripleTriadCardVariable.Length != 5)
{
PluginLog.Fatal($"Failed to parse npc data (num CV:{rowData.TripleTriadCardVariable.Length})");
return false;
}
for (int cardIdx = 0; cardIdx < rowData.TripleTriadCardVariable.Length; cardIdx++)
{
var cardRowIdx = rowData.TripleTriadCardVariable[cardIdx].Row;
if (cardRowIdx != 0)
{
if (cardRowIdx >= cardDB.cards.Count)
{
PluginLog.Fatal($"Failed to parse npc data (card.id:{cardRowIdx})");
return false;
}
cardsVariable[cardIdx] = (int)cardRowIdx;
numCardsVar++;
}
}
}
if (numCardsFixed == 0 && numCardsVar == 0)
{
// no cards = disabled, skip it
continue;
}
var npcIdData = mapTriadNpcData[rowData.RowId];
var npcOb = new TriadNpc(nameLocId, listRules, cardsFixed, cardsVariable);
npcOb.Name.Text = npcIdData.Name;
npcOb.OnNameUpdated();
nameLocId++;
// don't add to noc lists just yet, there are some entries with missing locations that need to be filtered out first!
var newCachedData = new ENpcCachedData() { triadId = npcIdData.TriadNpcId, gameLogicOb = npcOb, matchFee = rowData.Fee };
if (rowData.ItemPossibleReward != null && rowData.ItemPossibleReward.Length > 0)
{
newCachedData.rewardItems = new uint[rowData.ItemPossibleReward.Length];
for (int rewardIdx = 0; rewardIdx < rowData.ItemPossibleReward.Length; rewardIdx++)
{
newCachedData.rewardItems[rewardIdx] = rowData.ItemPossibleReward[rewardIdx].Row;
}
}
mapENpcCache.Add(npcIdData.ENpcId, newCachedData);
}
return true;
}
19
Source : DynamicTCPServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void UnsecureServer_SocketStatusChange(TCPServer server, uint clientIndex, SocketStatus serverSocketStatus)
{
Debug.Console(2, "Client at {0} ServerSocketStatus {1}",
server.GetAddressServerAcceptedConnectionFromForSpecificClient(clientIndex), serverSocketStatus.ToString());
if (server.GetServerSocketStatusForSpecificClient(clientIndex) == SocketStatus.SOCKET_STATUS_CONNECTED)
{
if (SharedKeyRequired && !WaitingForSharedKey.Contains(clientIndex))
WaitingForSharedKey.Add(clientIndex);
if (!ConnectedClientsIndexes.Contains(clientIndex))
ConnectedClientsIndexes.Add(clientIndex);
}
else
{
if (ConnectedClientsIndexes.Contains(clientIndex))
ConnectedClientsIndexes.Remove(clientIndex);
if (HeartbeatRequired && HeartbeatTimerDictionary.ContainsKey(clientIndex))
HeartbeatTimerDictionary.Remove(clientIndex);
}
if (UnsecureServer.ServerSocketStatus.ToString() != Status)
onConnectionChange();
}
19
Source : DynamicTCPServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void UnsecureReceivedDataAsyncCallback(TCPServer myTCPServer, uint clientIndex, int numberOfBytesReceived)
{
if (numberOfBytesReceived > 0)
{
string received = "Nothing";
byte[] bytes = myTCPServer.GetIncomingDataBufferForSpecificClient(clientIndex);
received = System.Text.Encoding.GetEncoding(28591).GetString(bytes, 0, numberOfBytesReceived);
if (WaitingForSharedKey.Contains(clientIndex))
{
received = received.Replace("\r", "");
received = received.Replace("\n", "");
if (received != SharedKey)
{
byte[] b = Encoding.GetEncoding(28591).GetBytes("Shared key did not match server. Disconnecting");
Debug.Console(2, "Client at index {0} Shared key did not match the server, disconnecting client", clientIndex);
ErrorLog.Error("Client at index {0} Shared key did not match the server, disconnecting client", clientIndex);
myTCPServer.SendDataAsync(clientIndex, b, b.Length, null);
myTCPServer.Disconnect(clientIndex);
}
if (myTCPServer.NumberOfClientsConnected > 0)
myTCPServer.ReceiveDataAsync(UnsecureReceivedDataAsyncCallback);
WaitingForSharedKey.Remove(clientIndex);
byte[] skResponse = Encoding.GetEncoding(28591).GetBytes("Shared Key Match, Connected and ready for communication");
myTCPServer.SendDataAsync(clientIndex, skResponse, skResponse.Length, null);
myTCPServer.ReceiveDataAsync(UnsecureReceivedDataAsyncCallback);
}
else
{
myTCPServer.ReceiveDataAsync(UnsecureReceivedDataAsyncCallback);
Debug.Console(2, "Secure Server Listening on Port: {0}, client IP: {1}, NumberOfBytesReceived: {2}, Received: {3}\r\n",
myTCPServer.PortNumber, myTCPServer.GetAddressServerAcceptedConnectionFromForSpecificClient(clientIndex), numberOfBytesReceived, received);
onTextReceived(received);
}
checkHeartbeat(clientIndex, received);
}
if (myTCPServer.GetServerSocketStatusForSpecificClient(clientIndex) == SocketStatus.SOCKET_STATUS_CONNECTED)
myTCPServer.ReceiveDataAsync(clientIndex, UnsecureReceivedDataAsyncCallback);
}
19
Source : GenericSecureTcpIpServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void SecureServer_SocketStatusChange(SecureTCPServer server, uint clientIndex, SocketStatus serverSocketStatus)
{
try
{
// Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "SecureServerSocketStatusChange Index:{0} status:{1} Port:{2} IP:{3}", clientIndex, serverSocketStatus, this.SecureServer.GetPortNumberServerAcceptedConnectionFromForSpecificClient(clientIndex), this.SecureServer.GetLocalAddressServerAcceptedConnectionFromForSpecificClient(clientIndex));
if (serverSocketStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "SecureServerSocketStatusChange ConnectedCLients: {0} ServerState: {1} Port: {2}", SecureServer.NumberOfClientsConnected, SecureServer.State, SecureServer.PortNumber);
if (ConnectedClientsIndexes.Contains(clientIndex))
ConnectedClientsIndexes.Remove(clientIndex);
if (HeartbeatRequired && HeartbeatTimerDictionary.ContainsKey(clientIndex))
{
HeartbeatTimerDictionary[clientIndex].Stop();
HeartbeatTimerDictionary[clientIndex].Dispose();
HeartbeatTimerDictionary.Remove(clientIndex);
}
if (ClientReadyAfterKeyExchange.Contains(clientIndex))
ClientReadyAfterKeyExchange.Remove(clientIndex);
if (WaitingForSharedKey.Contains(clientIndex))
WaitingForSharedKey.Remove(clientIndex);
if (SecureServer.MaxNumberOfClientSupported > SecureServer.NumberOfClientsConnected)
{
Listen();
}
}
}
catch (Exception ex)
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Socket Status Change Callback. Error: {0}", ex);
}
//Use a thread for this event so that the server state updates to listening while this event is processed. Listening must be added to the server state
//after every client connection so that the server can check and see if it is at max clients. Due to this the event fires and server listening enum bit flag
//is not set. Putting in a thread allows the state to update before this event processes so that the subscribers to this event get accurate isListening in the event.
CrestronInvoke.BeginInvoke(o => onConnectionChange(clientIndex, server.GetServerSocketStatusForSpecificClient(clientIndex)), null);
}
19
Source : GenericSecureTcpIpServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void SecureReceivedDataAsyncCallback(SecureTCPServer mySecureTCPServer, uint clientIndex, int numberOfBytesReceived)
{
if (numberOfBytesReceived > 0)
{
string received = "Nothing";
var handler = TextReceivedQueueInvoke;
try
{
byte[] bytes = mySecureTCPServer.GetIncomingDataBufferForSpecificClient(clientIndex);
received = System.Text.Encoding.GetEncoding(28591).GetString(bytes, 0, numberOfBytesReceived);
if (WaitingForSharedKey.Contains(clientIndex))
{
received = received.Replace("\r", "");
received = received.Replace("\n", "");
if (received != SharedKey)
{
byte[] b = Encoding.GetEncoding(28591).GetBytes("Shared key did not match server. Disconnecting");
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Client at index {0} Shared key did not match the server, disconnecting client. Key: {1}", clientIndex, received);
mySecureTCPServer.SendData(clientIndex, b, b.Length);
mySecureTCPServer.Disconnect(clientIndex);
return;
}
WaitingForSharedKey.Remove(clientIndex);
byte[] success = Encoding.GetEncoding(28591).GetBytes("Shared Key Match");
mySecureTCPServer.SendDataAsync(clientIndex, success, success.Length, null);
OnServerClientReadyForCommunications(clientIndex);
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Client with index {0} provided the shared key and successfully connected to the server", clientIndex);
}
else if (!string.IsNullOrEmpty(checkHeartbeat(clientIndex, received)))
{
onTextReceived(received, clientIndex);
if (handler != null)
{
MessageQueue.TryToEnqueue(new GenericTcpServerCommMethodReceiveTextArgs(received, clientIndex));
}
}
}
catch (Exception ex)
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error Receiving data: {0}. Error: {1}", received, ex);
}
if (mySecureTCPServer.GetServerSocketStatusForSpecificClient(clientIndex) == SocketStatus.SOCKET_STATUS_CONNECTED)
mySecureTCPServer.ReceiveDataAsync(clientIndex, SecureReceivedDataAsyncCallback);
//Check to see if there is a subscription to the TextReceivedQueueInvoke event. If there is start the dequeue thread.
if (handler != null)
{
var gotLock = DequeueLock.TryEnter();
if (gotLock)
CrestronInvoke.BeginInvoke((o) => DequeueEvent());
}
}
else
{
mySecureTCPServer.Disconnect(clientIndex);
}
}
19
Source : GenericTcpIpServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void TcpServer_SocketStatusChange(TCPServer server, uint clientIndex, SocketStatus serverSocketStatus)
{
try
{
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "SecureServerSocketStatusChange Index:{0} status:{1} Port:{2} IP:{3}", clientIndex, serverSocketStatus, this.myTcpServer.GetPortNumberServerAcceptedConnectionFromForSpecificClient(clientIndex), this.myTcpServer.GetLocalAddressServerAcceptedConnectionFromForSpecificClient(clientIndex));
if (serverSocketStatus != SocketStatus.SOCKET_STATUS_CONNECTED)
{
if (ConnectedClientsIndexes.Contains(clientIndex))
ConnectedClientsIndexes.Remove(clientIndex);
if (HeartbeatRequired && HeartbeatTimerDictionary.ContainsKey(clientIndex))
{
HeartbeatTimerDictionary[clientIndex].Stop();
HeartbeatTimerDictionary[clientIndex].Dispose();
HeartbeatTimerDictionary.Remove(clientIndex);
}
if (ClientReadyAfterKeyExchange.Contains(clientIndex))
ClientReadyAfterKeyExchange.Remove(clientIndex);
if (WaitingForSharedKey.Contains(clientIndex))
WaitingForSharedKey.Remove(clientIndex);
}
}
catch (Exception ex)
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error in Socket Status Change Callback. Error: {0}", ex);
}
onConnectionChange(clientIndex, server.GetServerSocketStatusForSpecificClient(clientIndex));
}
19
Source : GenericTcpIpServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void TcpServerReceivedDataAsyncCallback(TCPServer myTCPServer, uint clientIndex, int numberOfBytesReceived)
{
if (numberOfBytesReceived > 0)
{
string received = "Nothing";
try
{
byte[] bytes = myTCPServer.GetIncomingDataBufferForSpecificClient(clientIndex);
received = System.Text.Encoding.GetEncoding(28591).GetString(bytes, 0, numberOfBytesReceived);
if (WaitingForSharedKey.Contains(clientIndex))
{
received = received.Replace("\r", "");
received = received.Replace("\n", "");
if (received != SharedKey)
{
byte[] b = Encoding.GetEncoding(28591).GetBytes("Shared key did not match server. Disconnecting");
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Client at index {0} Shared key did not match the server, disconnecting client. Key: {1}", clientIndex, received);
myTCPServer.SendData(clientIndex, b, b.Length);
myTCPServer.Disconnect(clientIndex);
return;
}
WaitingForSharedKey.Remove(clientIndex);
byte[] success = Encoding.GetEncoding(28591).GetBytes("Shared Key Match");
myTCPServer.SendDataAsync(clientIndex, success, success.Length, null);
OnServerClientReadyForCommunications(clientIndex);
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Client with index {0} provided the shared key and successfully connected to the server", clientIndex);
}
else if (!string.IsNullOrEmpty(checkHeartbeat(clientIndex, received)))
onTextReceived(received, clientIndex);
}
catch (Exception ex)
{
Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Error Receiving data: {0}. Error: {1}", received, ex);
}
if (myTCPServer.GetServerSocketStatusForSpecificClient(clientIndex) == SocketStatus.SOCKET_STATUS_CONNECTED)
myTCPServer.ReceiveDataAsync(clientIndex, TcpServerReceivedDataAsyncCallback);
}
else
{
// If numberOfBytesReceived <= 0
myTCPServer.Disconnect();
}
}
19
Source : DynamicTCPServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void SecureServer_SocketStatusChange(SecureTCPServer server, uint clientIndex, SocketStatus serverSocketStatus)
{
Debug.Console(2, "Client at {0} ServerSocketStatus {1}",
server.GetAddressServerAcceptedConnectionFromForSpecificClient(clientIndex), serverSocketStatus.ToString());
if (server.GetServerSocketStatusForSpecificClient(clientIndex) == SocketStatus.SOCKET_STATUS_CONNECTED)
{
if (SharedKeyRequired && !WaitingForSharedKey.Contains(clientIndex))
WaitingForSharedKey.Add(clientIndex);
if (!ConnectedClientsIndexes.Contains(clientIndex))
ConnectedClientsIndexes.Add(clientIndex);
}
else
{
if (ConnectedClientsIndexes.Contains(clientIndex))
ConnectedClientsIndexes.Remove(clientIndex);
if (HeartbeatRequired && HeartbeatTimerDictionary.ContainsKey(clientIndex))
HeartbeatTimerDictionary.Remove(clientIndex);
}
if(SecureServer.ServerSocketStatus.ToString() != Status)
onConnectionChange();
}
19
Source : DynamicTCPServer.cs
with MIT License
from PepperDash
with MIT License
from PepperDash
void SecureReceivedDataAsyncCallback(SecureTCPServer mySecureTCPServer, uint clientIndex, int numberOfBytesReceived)
{
if (numberOfBytesReceived > 0)
{
string received = "Nothing";
byte[] bytes = mySecureTCPServer.GetIncomingDataBufferForSpecificClient(clientIndex);
received = System.Text.Encoding.GetEncoding(28591).GetString(bytes, 0, numberOfBytesReceived);
if (WaitingForSharedKey.Contains(clientIndex))
{
received = received.Replace("\r", "");
received = received.Replace("\n", "");
if (received != SharedKey)
{
byte[] b = Encoding.GetEncoding(28591).GetBytes("Shared key did not match server. Disconnecting");
Debug.Console(2, "Client at index {0} Shared key did not match the server, disconnecting client", clientIndex);
ErrorLog.Error("Client at index {0} Shared key did not match the server, disconnecting client", clientIndex);
mySecureTCPServer.SendDataAsync(clientIndex, b, b.Length, null);
mySecureTCPServer.Disconnect(clientIndex);
}
if (mySecureTCPServer.NumberOfClientsConnected > 0)
mySecureTCPServer.ReceiveDataAsync(SecureReceivedDataAsyncCallback);
WaitingForSharedKey.Remove(clientIndex);
byte[] skResponse = Encoding.GetEncoding(28591).GetBytes("Shared Key Match, Connected and ready for communication");
mySecureTCPServer.SendDataAsync(clientIndex, skResponse, skResponse.Length, null);
mySecureTCPServer.ReceiveDataAsync(SecureReceivedDataAsyncCallback);
}
else
{
mySecureTCPServer.ReceiveDataAsync(SecureReceivedDataAsyncCallback);
Debug.Console(2, "Secure Server Listening on Port: {0}, client IP: {1}, NumberOfBytesReceived: {2}, Received: {3}\r\n",
mySecureTCPServer.PortNumber, mySecureTCPServer.GetAddressServerAcceptedConnectionFromForSpecificClient(clientIndex), numberOfBytesReceived, received);
onTextReceived(received);
}
checkHeartbeat(clientIndex, received);
}
if (mySecureTCPServer.GetServerSocketStatusForSpecificClient(clientIndex) == SocketStatus.SOCKET_STATUS_CONNECTED)
mySecureTCPServer.ReceiveDataAsync(clientIndex, SecureReceivedDataAsyncCallback);
}
19
Source : AIStateFindMinerals.cs
with GNU General Public License v3.0
from Pyrdacor
with GNU General Public License v3.0
from Pyrdacor
bool SendGeologist(AI ai, Game game, Player player)
{
var militaryBuildings = game.GetPlayerBuildings(player).Where(building => building.IsMilitary());
List<uint> possibleSpots = new List<uint>();
// search for mountains near military buildings
foreach (var building in militaryBuildings)
{
if (game.Map.FindSpotNear(building.Position, 3, FindMountain, game.GetRandom(), 1) != Global.INVALID_MAPPOS)
{
possibleSpots.Add(game.Map.MoveDownRight(building.Position));
continue;
}
var position = building.Position;
FindNearbyMountain(game, player, ref position);
if (position != Global.INVALID_MAPPOS)
{
possibleSpots.Add(position);
}
}
if (possibleSpots.Count == 0) // no mountains in territory
{
// we need to increase our territory
if (player.GetIncompleteBuildingCount(Building.Type.Hut) == 0 &&
player.GetIncompleteBuildingCount(Building.Type.Tower) == 0 &&
player.GetIncompleteBuildingCount(Building.Type.Fortress) == 0 &&
!game.GetPlayerBuildings(player).Where(building => building.IsMilitary(false)).Any(b => !b.Hreplacederf))
{
// build only if there are no military buildings in progress or
// military buildings that are not occupied yet
NextState = ai.CreateState(AI.State.BuildBuilding, Building.Type.Hut);
}
return false;
}
var spotsWithFlag = possibleSpots.Where(possibleSpot => game.Map.HasFlag(possibleSpot) && game.Map.GetOwner(possibleSpot) == player.Index).ToList();
for (int i = 0; i < 10; ++i)
{
if (possibleSpots.Count == 0)
break;
uint spot = (spotsWithFlag.Count > 0) ? spotsWithFlag[game.GetRandom().Next() % spotsWithFlag.Count] :
possibleSpots[game.GetRandom().Next() % possibleSpots.Count];
var flag = game.GetFlagAtPosition(spot);
if (flag == null)
{
if (!game.BuildFlag(spot, player))
{
bool built = false;
for (int d = 0; d < 5; ++d)
{
spot = game.Map.MoveTowards(spot, player.CastlePosition);
if (game.BuildFlag(spot, player))
{
built = true;
break;
}
}
if (!built)
{
possibleSpots.Remove(spot);
continue;
}
}
flag = game.GetFlagAtPosition(spot);
// link flag
var flagPositions = game.Map.FindInArea(flag.Position, 7, FindFlag, 2).Select(d => (uint)d);
Road bestRoad = null;
foreach (var flagPosition in flagPositions)
{
var road = Pathfinder.FindShortestPath(game.Map, flag.Position, flagPosition, null, 10);
if (road != null && road.Valid)
{
if (bestRoad == null || bestRoad.Length > road.Length)
bestRoad = road;
}
}
if (bestRoad != null)
game.BuildRoad(bestRoad, player);
}
return game.SendGeologist(flag);
}
return false;
}
19
Source : PlaybackStream.cs
with GNU General Public License v3.0
from RhubarbVR
with GNU General Public License v3.0
from RhubarbVR
void CleanupPlayedBuffers()
{
if (_sourceId == 0)
{
return;
}
API.alGetSourcei(_sourceId, IntSourceProperty.AL_BUFFERS_PROCESSED, out var buffers);
if (buffers < 1)
{
return;
}
var removedBuffers = new uint[buffers];
API.alSourceUnqueueBuffers(_sourceId, buffers, removedBuffers);
API.alDeleteBuffers(buffers, removedBuffers);
lock (_bufferIds)
{
foreach (var bufferId in removedBuffers)
{
_bufferIds.Remove(bufferId);
}
}
}
19
Source : JobMatchmaker.cs
with Mozilla Public License 2.0
from RHY3756547
with Mozilla Public License 2.0
from RHY3756547
public void RemoveAvatar(uint lotID, uint avatarID)
{
lock (this)
{
JobEntry instance = null;
InstanceForAvatar.Remove(avatarID);
if (InstanceIDToInstance.TryGetValue(lotID, out instance))
{
foreach (var type in instance.Avatars)
{
type.Remove(avatarID);
}
}
}
}
19
Source : UILotPage.cs
with Mozilla Public License 2.0
from RHY3756547
with Mozilla Public License 2.0
from RHY3756547
private void RefreshUI()
{
var isOpen = _Open == true;
var isClosed = _Open == false;
var isMyProperty = false;
var isRoommate = false;
var isOnline = false;
var isCommunity = false;
NeighborhoodNameButton.Size = new Vector2(173, 18);
if (CurrentLot != null && CurrentLot.Value != null)
{
isOnline = CurrentLot.Value.Lot_IsOnline || (CurrentLot.Value.Lot_LotAdmitInfo?.LotAdmitInfo_AdmitMode >= 4);
isMyProperty = FindController<CoreGameScreenController>().IsMe(CurrentLot.Value.Lot_LeaderID);
isCommunity = CurrentLot.Value.Lot_Category == 11;
var roomies = new List<uint>();
if (CurrentLot.Value.Lot_RoommateVec != null) roomies.AddRange(CurrentLot.Value.Lot_RoommateVec);
roomies.Remove(CurrentLot.Value.Lot_LeaderID);
foreach (var roomie in roomies) if (FindController<CoreGameScreenController>().IsMe(roomie)) isRoommate = true;
RoommateList.UpdateList(roomies);
SkillGameplayLabel.Caption = GameFacade.Strings.GetString("f109", (CurrentLot.Value.Lot_SkillGamemode+1).ToString());
SkillGameplayLabel.Visible = isOpen;
SkillGameplayLabel.CaptionStyle.Color = isMyProperty ? Color.LightBlue : TextStyle.DefaultLabel.Color;
//var thumb = CurrentLot.Value.Lot_Thumbnail.Data;
//if (((thumb?.Length) ?? 0) == 0)
//LotThumbnail.SetThumbnail(DefaultThumb, 0);
//else
// LotThumbnail.SetThumbnail(ImageLoader.FromStream(GameFacade.GraphicsDevice, new MemoryStream(thumb)), CurrentLot.Value.Id);
if (OriginalDescription != CurrentLot.Value.Lot_Description)
{
OriginalDescription = CurrentLot.Value.Lot_Description;
HouseDescriptionTextEdit.CurrentText = OriginalDescription;
}
}
bool inBounds = CurrentLot.Value == null || CurrentLot.Value.Lot_Location_Packed < 0x10200 || CurrentLot.Value.Lot_Location_Packed >= 0x20000;
var canJoin = isMyProperty || isRoommate || (inBounds && (isOnline || isCommunity)) || GameFacade.EnableMod;
HouseNameButton.Disabled = !isMyProperty;
BackgroundContractedImage.Visible = isClosed;
BackgroundExpandedImage.Visible = isOpen;
RoommateList.Visible = isOpen;
ExpandButton.Visible = isClosed;
ExpandedCloseButton.Visible = isOpen;
ContractButton.Visible = isOpen;
ContractedCloseButton.Visible = isClosed;
BackgroundDescriptionImage.Visible = isOpen && !isMyProperty;
BackgroundDescriptionEditImage.Visible = isOpen && isMyProperty;
HouseDescriptionTextEdit.Mode = (isMyProperty) ? UITextEditMode.Editor : UITextEditMode.ReadOnly;
HouseDescriptionSlider.Visible =
HouseDescriptionTextEdit.Visible =
HouseDescriptionScrollUpButton.Visible =
HouseDescriptionScrollDownButton.Visible = isOpen;
VisitorsLeftScrollButton.Visible = VisitorsRightScrollButton.Visible = isOpen;
HouseCategoryButton.Disabled = !isMyProperty;
if (isMyProperty) LotThumbnail.Mode = UILotRelationship.OWNER;
else if (isRoommate) LotThumbnail.Mode = UILotRelationship.ROOMMATE;
else LotThumbnail.Mode = UILotRelationship.VISITOR;
if(canJoin){
HouseLinkButton.Disabled = false;
LotThumbnail.Disabled = false;
}else{
HouseLinkButton.Disabled = true;
LotThumbnail.Disabled = true;
}
}
19
Source : SteamP2PTransport.cs
with MIT License
from Unity-Technologies
with MIT License
from Unity-Technologies
public void SetPing(uint ping)
{
lastPings.Add(ping);
sortedPings.Add(ping);
if (lastPings.Count > 10)
{
sortedPings.Remove(lastPings[0]);
lastPings.RemoveAt(0);
}
sortedPings.Sort();
pingValue = sortedPings[Mathf.FloorToInt(lastPings.Count / 2)];
}
19
Source : GameState.cs
with MIT License
from V1nChy
with MIT License
from V1nChy
public void RemoveOutStateId(uint state_id)
{
this.m_out_state_id_list.Remove(state_id);
}
19
Source : GameStateMachine.cs
with MIT License
from V1nChy
with MIT License
from V1nChy
public void DestroyState(uint state_id)
{
GameState state = this.FindState(state_id);
if (state != null)
{
GameStateMachine.GameStateSink sink = this.FindSink(state.GetSinkId());
uint cur_run_state_id = sink.cur_state_id;
sink.contain_state_id_list.Remove(state_id);
bool need_cancel_cur_state = false;
if (this.IsInState(state_id))
{
state.Exit();
need_cancel_cur_state = true;
}
if (state.GetComposeType() == StateComposeType.SCT_SUB)
{
GameState parent_state = this.FindState(state.m_parent_state_id);
if (need_cancel_cur_state)
{
parent_state.m_cur_run_sub = ushort.MaxValue;
parent_state.m_previous_sub = ushort.MaxValue;
}
parent_state.m_sub_state_id_list.Remove(state_id);
}
else
{
sink.contain_state_id_list.Remove(state_id);
if (need_cancel_cur_state)
{
sink.cur_state_id = ushort.MaxValue;
sink.previous_state_id = ushort.MaxValue;
}
if (state.GetComposeType() == StateComposeType.SCT_COMPOSE)
{
state.DestroyAllSubStates();
}
}
state.Dispose();
this.m_state_array[(int)state_id] = null;
this.m_free_state_id_list.Add(state_id);
}
}
See More Examples