private void OnAltClick() { if (this.slotItem != null) { RPOS.GetRightClickMenu().SetItem(this.slotItem); } }
public void ClientHealthChange(float amount, GameObject attacker) { float health = base.health; base.AdjustClientSideHealth(amount); float num2 = amount; float num3 = Mathf.Abs((float)(num2 - health)); bool flag = amount < health; float healthFraction = base.healthFraction; if (base.localControlled && (num3 >= 1f)) { base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(healthFraction, attacker); } if ((((attacker != null) && flag) && (num3 >= 1f)) && ((hudDamagePrefab != null) || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out hudDamagePrefab))) { Vector3 vector; Character character; if (IDBase.GetMain <Character>(attacker, out character)) { vector = base.eyesOrigin - character.eyesOrigin; } else { vector = base.origin - attacker.transform.position; } HUDDirectionalDamage.CreateIndicator(vector, (double)amount, NetCull.time, 1.6000000238418579, hudDamagePrefab); } RPOS.HealthUpdate(amount); }
private void OnDragState(bool start) { if (start) { if (!this.dragging && !this.startedNoItem) { UICamera.Cursor.DropNotification = DropNotificationFlags.DragLand | DropNotificationFlags.AltLand | DropNotificationFlags.RegularHover | DropNotificationFlags.DragLandOutside; this.lastLanding = null; this.dragging = true; RPOS.Item_CellDragBegin(this); UICamera.Cursor.CurrentButton.ClickNotification = UICamera.ClickNotification.BasedOnDelta; } } else if (this.dragging) { this.dragging = false; if (!this.lastLanding) { RPOS.Item_CellReset(); } else { this.dragging = false; RPOS.Item_CellDragEnd(this, this.lastLanding); UICamera.Cursor.Buttons.LeftValue.ClickNotification = UICamera.ClickNotification.None; } } }
public void InventoryModified() { if (base.localControlled) { RPOS.LocalInventoryModified(); } }
public void ForceUpdate() { DamageTypeList armorValues; HumanBodyTakeDamage damage; if (RPOS.GetObservedPlayerComponent <HumanBodyTakeDamage>(out damage)) { armorValues = damage.GetArmorValues(); } else { armorValues = new DamageTypeList(); } this.leftText.text = string.Empty; this.rightText.text = string.Empty; for (int i = 0; i < 6; i++) { if (armorValues[i] != 0f) { this.leftText.text = this.leftText.text + TakeDamage.DamageIndexToString((DamageTypeIndex)i) + "\n"; string text = this.rightText.text; object[] objArray1 = new object[] { text, "+", (int)armorValues[i], "\n" }; this.rightText.text = string.Concat(objArray1); } } }
protected void SetLooter(uLink.NetworkPlayer ply) { this.occupierText = null; if (ply == uLink.NetworkPlayer.unassigned) { this.ClearLooter(); } else { if (ply == NetCull.player) { if (!this.thisClientIsInWindow) { try { this._currentlyUsingPlayer = ply; RPOS.OpenLootWindow(this); this.thisClientIsInWindow = true; } catch (Exception exception) { Debug.LogError(exception, this); NetCull.RPC((UnityEngine.MonoBehaviour) this, "StopLooting", uLink.RPCMode.Server); this.thisClientIsInWindow = false; ply = uLink.NetworkPlayer.unassigned; } } } else if ((this._currentlyUsingPlayer == NetCull.player) && (NetCull.player != uLink.NetworkPlayer.unassigned)) { this.ClearLooter(); } this._currentlyUsingPlayer = ply; } }
private void Update() { IInventoryItem inventoryItem; if (this._displayInventory) { if (!RPOS.Item_IsClickedCell(this)) { this._displayInventory.GetItem((int)this._mySlot, out inventoryItem); if (this._displayInventory.MarkSlotClean((int)this._mySlot) || !object.ReferenceEquals(this._myDisplayItem, inventoryItem)) { this.SetItem(inventoryItem); } } else { this.MakeEmpty(); } if (!RPOS.IsOpen && this._darkener) { if (this.backupColor == Color.cyan) { this.backupColor = this._darkener.color; } if (this._myDisplayItem == null || this._displayInventory._activeItem != this._myDisplayItem) { this._darkener.color = this.backupColor; } else { this._darkener.color = Color.grey; } } } }
private void OnLandOutside() { if (this._displayInventory.gameObject == RPOS.ObservedPlayer.gameObject) { RPOS.TossItem(this._mySlot); } }
public void Populate() { this.Clear(); List <RPOSWindow> rPOSWindows = new List <RPOSWindow>(RPOS.GetBumperWindowList()); int count = rPOSWindows.Count; for (int i = 0; i < count; i++) { if (!rPOSWindows[i] || string.IsNullOrEmpty(rPOSWindows[i].title)) { int num = i; i = num - 1; rPOSWindows.RemoveAt(num); count--; } else { rPOSWindows[i].EnsureAwake <RPOSWindow>(); } } Vector3 vector3 = this.buttonPrefab.gameObject.transform.localScale; float single = 75f * vector3.x; float single1 = 5f; float single2 = (float)count * single * -0.5f; int num1 = 0; if (this.instances == null) { this.instances = new HashSet <RPOSBumper.Instance>(); } foreach (RPOSWindow rPOSWindow in rPOSWindows) { RPOSBumper.Instance instance = new RPOSBumper.Instance() { window = rPOSWindow }; Vector3 vector31 = this.buttonPrefab.gameObject.transform.localScale; GameObject gameObject = NGUITools.AddChild(base.gameObject, this.buttonPrefab.gameObject); instance.label = gameObject.gameObject.GetComponentInChildren <UILabel>(); instance.label.name = string.Concat(rPOSWindow.title, "BumperButton"); Vector3 vector32 = gameObject.transform.localPosition; vector32.x = single2 + (single + single1) * (float)num1; gameObject.transform.localPosition = vector32; gameObject.transform.localScale = vector31; instance.button = gameObject.GetComponentInChildren <UIButton>(); instance.bumper = this; rPOSWindow.AddBumper(instance); this.instances.Add(instance); num1++; } Vector3 vector33 = this.background.transform.localScale; vector33.x = (float)count * single + ((float)count - 1f * single1); this.background.gameObject.transform.localScale = vector33; Transform transforms = this.background.gameObject.transform; Vector3 vector34 = base.transform.localPosition; transforms.localPosition = new Vector3(vector33.x * -0.5f, vector34.y, 0f); }
public void SetLegInjury(float injAmount) { this.injuryLevel = injAmount; if (base.character.localPlayerControlled) { RPOS.InjuryUpdate(); } }
private void OnAltLand(GameObject landing) { RPOSInventoryCell component = landing.GetComponent <RPOSInventoryCell>(); if (component != null) { RPOS.ItemCellAltClicked(component); } }
protected virtual void CreateCellsOnGameObject(Inventory inven, GameObject parent) { int numCells; int end; Inventory.Slot.Range range; if (!inven) { numCells = this.GetNumCells(); end = 2147483647; } else { inven.GetSlotsOfKind(Inventory.Slot.Kind.Default, out range); numCells = range.Count; end = range.End; } Array.Resize <RPOSInventoryCell>(ref this._inventoryCells, numCells); Vector3 component = this.CellPrefab.GetComponent <RPOSInventoryCell>()._background.transform.localScale; float single = component.x; Vector3 vector3 = this.CellPrefab.GetComponent <RPOSInventoryCell>()._background.transform.localScale; float single1 = vector3.y; for (int i = 0; i < this.NumCellsVertical; i++) { for (int j = 0; j < this.NumCellsHorizontal; j++) { byte cellIndexStart = (byte)(this.CellIndexStart + RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal)); if (cellIndexStart >= end) { return; } GameObject gameObject = NGUITools.AddChild(parent, this.CellPrefab); RPOSInventoryCell str = gameObject.GetComponent <RPOSInventoryCell>(); str._mySlot = cellIndexStart; str._displayInventory = inven; if (this.NumberedCells) { int index2D = RPOSInvCellManager.GetIndex2D(j, i, this.NumCellsHorizontal) + 1; str._numberLabel.text = index2D.ToString(); } gameObject.transform.localPosition = new Vector3((float)this.CellOffsetX + ((float)j * single + (float)(j * this.CellSpacing)), -((float)this.CellOffsetY + ((float)i * single1 + (float)(i * this.CellSpacing))), -2f); this._inventoryCells[RPOS.GetIndex2D(j, i, this.NumCellsHorizontal)] = gameObject.GetComponent <RPOSInventoryCell>(); } } if (this.CenterFromCells) { if (this.NumCellsHorizontal > 1) { base.transform.localPosition = new Vector3((float)(this.CellOffsetX + this.NumCellsHorizontal * this.CellSize + (this.NumCellsHorizontal - 1) * this.CellSpacing) * -0.5f, (float)this.CellSize, 0f); } else if (this.NumCellsVertical > 1) { base.transform.localPosition = new Vector3((float)(-this.CellSize), (float)(this.CellOffsetY + this.NumCellsVertical * this.CellSize) * 0.5f, 0f); } } }
private void _EnsureDestroy() { if (this._awake) { if (!this._lock_destroy) { try { try { this._lock_destroy = true; if (this.closeButtonListener) { this.closeButtonListener.onClick -= this.buttonCallback; } if (!this._closed) { this._showWithRPOS = false; this._showWithoutRPOS = false; this.CheckDisplay(); if (this._opened && !this._closed) { this.WindowClose(); } } this.WindowDestroy(); } catch (Exception exception1) { Exception exception = exception1; Debug.LogError(string.Format("A exception was thrown during window destroy ({0}, title={1}) and potentially screwed up stuff, exception is below\r\n{2}", this, this.TitleText, exception), this); } } finally { this._destroyed = true; this._lock_destroy = false; RPOS.UnregisterWindow(this); } } else { Debug.LogWarning("Something tried to destroy while this window was destroying", this); } } else if (this._lock_awake) { Debug.LogWarning("This window was awakening.. the call to destroy will happen when its done. Look at call stack. Avoid this.", this); this._destroyAfterAwake = true; } else if (!this._lock_destroy) { this._lock_destroy = true; Debug.LogWarning("This window is being destroyed, and has never got it's Awake.", this); } }
protected virtual void CreateCellsOnGameObject(Inventory inven, GameObject parent) { int count; int end; if (inven != null) { Inventory.Slot.Range range; inven.GetSlotsOfKind(Inventory.Slot.Kind.Default, out range); count = range.Count; end = range.End; } else { count = this.GetNumCells(); end = 0x7fffffff; } Array.Resize <RPOSInventoryCell>(ref this._inventoryCells, count); float x = this.CellPrefab.GetComponent <RPOSInventoryCell>()._background.transform.localScale.x; float y = this.CellPrefab.GetComponent <RPOSInventoryCell>()._background.transform.localScale.y; for (int i = 0; i < this.NumCellsVertical; i++) { for (int j = 0; j < this.NumCellsHorizontal; j++) { byte num7 = (byte)(this.CellIndexStart + GetIndex2D(j, i, this.NumCellsHorizontal)); if (num7 >= end) { return; } GameObject obj2 = NGUITools.AddChild(parent, this.CellPrefab); RPOSInventoryCell component = obj2.GetComponent <RPOSInventoryCell>(); component._mySlot = num7; component._displayInventory = inven; if (this.NumberedCells) { component._numberLabel.text = (GetIndex2D(j, i, this.NumCellsHorizontal) + 1).ToString(); } obj2.transform.localPosition = new Vector3(this.CellOffsetX + ((j * x) + (j * this.CellSpacing)), -(this.CellOffsetY + ((i * y) + (i * this.CellSpacing))), -2f); this._inventoryCells[RPOS.GetIndex2D(j, i, this.NumCellsHorizontal)] = obj2.GetComponent <RPOSInventoryCell>(); } } if (this.CenterFromCells) { if (this.NumCellsHorizontal > 1) { base.transform.localPosition = new Vector3((this.CellOffsetX + ((this.NumCellsHorizontal * this.CellSize) + ((this.NumCellsHorizontal - 1) * this.CellSpacing))) * -0.5f, (float)this.CellSize, 0f); } else if (this.NumCellsVertical > 1) { base.transform.localPosition = new Vector3((float)-this.CellSize, (this.CellOffsetY + (this.NumCellsVertical * this.CellSize)) * 0.5f, 0f); } } }
public void Local_BleedChange(float amount) { if (this.humanBodyTakeDamage) { this.humanBodyTakeDamage._bleedingLevel = amount; } if (base.localControlled) { RPOS.SetPlaqueActive("PlaqueBleeding", this.humanBodyTakeDamage._bleedingLevel > 0f); } }
public void FinishBandage() { this.bandageStartTime = -1f; RPOS.SetActionProgress(false, null, 0f); int numWant = 1; if (base.Consume(ref numWant)) { base.inventory.RemoveItem(base.slot); } base.itemRepresentation.Action(3, uLink.RPCMode.Server); }
public void Populate() { this.Clear(); List <RPOSWindow> list = new List <RPOSWindow>(RPOS.GetBumperWindowList()); int count = list.Count; for (int i = 0; i < count; i++) { if ((list[i] != null) && !string.IsNullOrEmpty(list[i].title)) { list[i].EnsureAwake <RPOSWindow>(); } else { list.RemoveAt(i--); count--; } } float num3 = 75f * this.buttonPrefab.gameObject.transform.localScale.x; float num4 = 5f; float num5 = (count * num3) * -0.5f; int num6 = 0; if (this.instances == null) { this.instances = new HashSet <Instance>(); } foreach (RPOSWindow window in list) { Instance inst = new Instance { window = window }; Vector3 vector = this.buttonPrefab.gameObject.transform.localScale; GameObject obj2 = NGUITools.AddChild(base.gameObject, this.buttonPrefab.gameObject); inst.label = obj2.gameObject.GetComponentInChildren <UILabel>(); inst.label.name = window.title + "BumperButton"; Vector3 localPosition = obj2.transform.localPosition; localPosition.x = num5 + ((num3 + num4) * num6); obj2.transform.localPosition = localPosition; obj2.transform.localScale = vector; inst.button = obj2.GetComponentInChildren <UIButton>(); inst.bumper = this; window.AddBumper(inst); this.instances.Add(inst); num6++; } Vector3 localScale = this.background.transform.localScale; localScale.x = (count * num3) + (count - (1f * num4)); this.background.gameObject.transform.localScale = localScale; this.background.gameObject.transform.localPosition = new Vector3(localScale.x * -0.5f, base.transform.localPosition.y, 0f); }
private void SetUser(uLink.NetworkPlayer ply) { if (ply == NetCull.player) { RPOS.OpenWorkbenchWindow(this); } else if (this._currentlyUsingPlayer == NetCull.player && ply != this._currentlyUsingPlayer) { this._currentlyUsingPlayer = uLink.NetworkPlayer.unassigned; RPOS.CloseWorkbenchWindow(); } this._currentlyUsingPlayer = ply; }
protected override void OnControlEnter() { base.OnControlEnter(); if (base.localControlled) { this.clientVitalsSync = base.AddAddon <ClientVitalsSync>(); ImageEffectManager.GetInstance <GameFullscreen>().fadeColor = Color.black; ImageEffectManager.GetInstance <GameFullscreen>().tintColor = Color.white; RPOS.DoFade(2f, 2.5f, Color.clear); RPOS.SetCurrentFade(Color.black); RPOS.HealthUpdate(base.health); RPOS.ObservedPlayer = base.controllable; } }
private string ParseResponse(byte[] buffer) { var pos = 0; var header = Encoding.UTF8.GetString(buffer, pos, 4); buffer = buffer.Skip(5).ToArray(); if (header == "RPOS") // Ignore other messages { RPOS rpos = ByteArrayToStructure <RPOS>(buffer); return(rpos.ToString()); } return(null); }
public virtual InventoryItem.MenuItemResult ExecuteMenuOption(InventoryItem.MenuItem option, IInventoryItem item) { InventoryItem.MenuItem menuItem = option; if (menuItem == InventoryItem.MenuItem.Info) { RPOS.OpenInfoWindow(this); return(InventoryItem.MenuItemResult.DoneOnClient); } if (menuItem != InventoryItem.MenuItem.Split) { return(InventoryItem.MenuItemResult.Unhandled); } item.inventory.SplitStack(item.slot); return(InventoryItem.MenuItemResult.Complete); }
public void RecieveNetwork(float calories, float water, float rad, float anti, float temp, float poison) { this.caloricLevel = calories; this.waterLevelLitre = water; this.radiationLevel = rad; this.antiRads = anti; this.coreTemperature = temp; this.poisonLevel = poison; if (temp >= 1f) { this._lastWarmTime = Time.time; } else if (temp < 0f) { this._lastWarmTime = -1000f; } RPOS.MetabolismUpdate(); }
void ExecuteResponse(byte[] buffer) { var pos = 0; var header = Encoding.UTF8.GetString(buffer, pos, 4); buffer = buffer.Skip(5).ToArray(); if (header == "RPOS" && runningSubscription != null) { RPOS rpos = ByteArrayToStructure <RPOS>(buffer); EHSI.FlightHeading = rpos.veh_psi_loc; EHSI.Latitude = rpos.dat_lat; EHSI.Longitude = rpos.dat_lon; EHSI.MeanAltitude = rpos.dat_ele; EHSI.CalculateWaypoint(); } }
protected void ClearLooter() { this.occupierText = null; this._currentlyUsingPlayer = uLink.NetworkPlayer.unassigned; if (this.thisClientIsInWindow) { try { RPOS.CloseLootWindow(); } catch (Exception exception) { Debug.LogError(exception); } finally { this.thisClientIsInWindow = false; } } }
protected void ArmorData(byte[] data) { DamageTypeList damageTypeList = new DamageTypeList(); uLink.BitStream bitStream = new uLink.BitStream(data, false); for (int i = 0; i < 6; i++) { damageTypeList[i] = bitStream.ReadSingle(); } ProtectionTakeDamage protectionTakeDamage = this.takeDamage; if (protectionTakeDamage) { protectionTakeDamage.SetArmorValues(damageTypeList); } if (base.localPlayerControlled) { RPOS.SetEquipmentDirty(); } }
public void ForceUpdate() { DamageTypeList damageTypeList; HumanBodyTakeDamage humanBodyTakeDamage; damageTypeList = (!RPOS.GetObservedPlayerComponent <HumanBodyTakeDamage>(out humanBodyTakeDamage) ? new DamageTypeList() : humanBodyTakeDamage.GetArmorValues()); this.leftText.text = string.Empty; this.rightText.text = string.Empty; for (int i = 0; i < 6; i++) { if (damageTypeList[i] != 0f) { UILabel uILabel = this.leftText; uILabel.text = string.Concat(uILabel.text, TakeDamage.DamageIndexToString((DamageTypeIndex)i), "\n"); UILabel uILabel1 = this.rightText; string str = uILabel1.text; uILabel1.text = string.Concat(new object[] { str, "+", (int)damageTypeList[i], "\n" }); } } }
protected void ArmorData(byte[] data) { DamageTypeList armor = new DamageTypeList(); BitStream stream = new BitStream(data, false); for (int i = 0; i < 6; i++) { armor[i] = stream.ReadSingle(); } ProtectionTakeDamage takeDamage = this.takeDamage; if (takeDamage != null) { takeDamage.SetArmorValues(armor); } if (base.localPlayerControlled) { RPOS.SetEquipmentDirty(); } }
public void ClientHealthChange(float amount, GameObject attacker) { Vector3 vector3; Character character; float single = base.health; base.AdjustClientSideHealth(amount); float single1 = Mathf.Abs(amount - single); bool flag = amount < single; float single2 = base.healthFraction; if (base.localControlled && single1 >= 1f) { base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(single2, attacker); } if (attacker && flag && single1 >= 1f && (ClientVitalsSync.hudDamagePrefab || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out ClientVitalsSync.hudDamagePrefab))) { vector3 = (!IDBase.GetMain <Character>(attacker, out character) ? base.origin - attacker.transform.position : base.eyesOrigin - character.eyesOrigin); HUDDirectionalDamage.CreateIndicator(vector3, (double)amount, NetCull.time, 1.60000002384186, ClientVitalsSync.hudDamagePrefab); } RPOS.HealthUpdate(amount); }
public virtual void Primary(ref HumanController.InputSample sample) { this.lastFramePrimary = true; sample.crouch = true; sample.walk = 0f; sample.strafe = 0f; sample.jump = false; sample.sprint = false; if (this.bandageStartTime == -1f) { this.StartBandage(); } float single = Time.time - this.bandageStartTime; float single1 = Mathf.Clamp(single / (T)this.datablock.bandageDuration, 0f, 1f); string empty = string.Empty; bool flag = this.datablock.DoesGiveBlood(); bool flag1 = this.datablock.DoesBandage(); if (flag1 && !flag) { empty = "Bandaging..."; } else if (flag1 && flag) { empty = "Bandage + Transfusion..."; } else if (!flag1 && flag) { empty = "Transfusing..."; } RPOS.SetActionProgress(true, empty, single1); if (single1 >= 1f) { this.FinishBandage(); } }
public virtual void Primary(ref HumanController.InputSample sample) { this.lastFramePrimary = true; sample.crouch = true; sample.walk = 0f; sample.strafe = 0f; sample.jump = false; sample.sprint = false; if (this.bandageStartTime == -1f) { this.StartBandage(); } float num = Time.time - this.bandageStartTime; float progress = Mathf.Clamp((float)(num / base.datablock.bandageDuration), (float)0f, (float)1f); string label = string.Empty; bool flag = base.datablock.DoesGiveBlood(); bool flag2 = base.datablock.DoesBandage(); if (flag2 && !flag) { label = "Bandaging..."; } else if (flag2 && flag) { label = "Bandage + Transfusion..."; } else if (!flag2 && flag) { label = "Transfusing..."; } RPOS.SetActionProgress(true, label, progress); if (progress >= 1f) { this.FinishBandage(); } }