public static void OnServerRemovePin(ZRpc _, ZPackage pinData) { if (!Store.IsSharingPin()) { return; } pinData.SetPos(0); Utility.Log("Client deleted pin by server"); var pin = ExplorationDatabase.UnpackPin(pinData); foreach (var clientPin in ExplorationDatabase.ClientPins.ToList()) { if (UtilityPin.ArePinsEqual(clientPin, pin)) { ExplorationDatabase.ClientPins.Remove(clientPin); } } var mapPin = UtilityPin.GetMapPin(pin); if (mapPin == null) { return; } _Minimap.RemovePin(_Minimap._instance, mapPin); }
public static void OnServerCheckPin(ZRpc client, ZPackage data) { if (!Store.IsSharingPin()) { return; } data.SetPos(0); Utility.Log("Client checked pin by server"); var pin = ExplorationDatabase.UnpackPin(data); var state = data.ReadBool(); foreach (var clientPin in ExplorationDatabase.ClientPins.ToList()) { if (UtilityPin.ArePinsEqual(clientPin, pin)) { clientPin.Checked = state; var mapPin = UtilityPin.GetMapPin(clientPin); if (mapPin != null) { mapPin.m_checked = state; } } } }
private static void ClientAppendPins() { if (!Store.IsSharingPin()) { return; } Utility.Log("ClientAppendPins " + ExplorationDatabase.ClientPins.Count); foreach (var pin in ExplorationDatabase.ClientPins) { var mapPin = UtilityPin.GetMapPin(pin); if (mapPin != null) { _Minimap.RemovePin(_Minimap._instance, mapPin); } _Minimap.AddPin(_Minimap._instance, pin.Pos, pin.Type, pin.Name, false, pin.Checked, 0); } }
// ReSharper disable once InconsistentNaming private static void Postfix(Minimap __instance, ref Minimap.PinData __result, Vector3 pos, float radius) { if (!Store.IsSharingPin()) { return; } LatestClosestPin = __result; var pinData = (PinData)null; var num1 = 999999f; foreach (var p in ExplorationDatabase.ClientPins) { var num2 = Utils.DistanceXZ(pos, p.Pos); if ((double)num2 < (double)radius && ((double)num2 < (double)num1 || pinData == null)) { pinData = p; num1 = num2; } } if (pinData == null) { return; } var pin = UtilityPin.GetMapPin(pinData); if (__result == null) { __result = pin; LatestClosestPin = pin; return; } var distance = Utils.DistanceXZ(pos, __result.m_pos); if (distance > num1) { __result = pin; LatestClosestPin = pin; } }