public static Texture2D GetPrevIMG() { SnapShotSaves.currentIndex--; if (SnapShotSaves.currentIndex < 0) { SnapShotSaves.currentIndex = SnapShotSaves.maxIndex - 1; } return(SnapShotSaves.getCurrentIMG()); }
public static Texture2D GetNextIMG() { SnapShotSaves.currentIndex++; if (SnapShotSaves.currentIndex >= SnapShotSaves.maxIndex) { SnapShotSaves.currentIndex = 0; } return(SnapShotSaves.getCurrentIMG()); }
private void Start() { QualitySettings.SetQualityLevel(5, true); //this.page = this.labelPage.GetComponent<UILabel>(); if (SnapShotSaves.getLength() > 0) { //this.texture.GetComponent<UITexture>().mainTexture = SnapShotSaves.getCurrentIMG(); } //this.labelInfo.GetComponent<UILabel>().text = LoginFengKAI.player.name + " " + DateTime.Today.ToShortDateString(); this.freshInfo(); this.setTextureWH(); }
private void Start() { QualitySettings.SetQualityLevel(5, applyExpensiveChanges: true); page = labelPage.GetComponent <UILabel>(); if (SnapShotSaves.GetLength() > 0) { texture.GetComponent <UITexture>().mainTexture = SnapShotSaves.GetCurrentImage(); } labelInfo.GetComponent <UILabel>().text = LoginFengKAI.Player.Name + " " + DateTime.Today.ToShortDateString(); RefreshInfo(); SetTextureDimensions(); }
public static void addIMG(Texture2D t, int d) { SnapShotSaves.init(); SnapShotSaves.img[SnapShotSaves.index] = t; SnapShotSaves.dmg[SnapShotSaves.index] = d; SnapShotSaves.currentIndex = SnapShotSaves.index; SnapShotSaves.index++; if (SnapShotSaves.index >= SnapShotSaves.img.Length) { SnapShotSaves.index = 0; } SnapShotSaves.maxIndex = Mathf.Max(SnapShotSaves.index, SnapShotSaves.maxIndex); }
private void RefreshInfo() { if (SnapShotSaves.GetLength() == 0) { page.text = " 0 / 0"; } else { page.text = " " + (SnapShotSaves.GetCurrentIndex() + 1) + " / " + SnapShotSaves.GetLength(); } if (SnapShotSaves.GetCurrentDamage() > 0) { labelDMG.GetComponent <UILabel>().text = SnapShotSaves.GetCurrentDamage().ToString(); } else { labelDMG.GetComponent <UILabel>().text = string.Empty; } }
private void freshInfo() { if (SnapShotSaves.getLength() == 0) { //this.page.text = "0/0"; } else { //this.page.text = ((SnapShotSaves.getCurrentIndex() + 1)).ToString() + "/" + SnapShotSaves.getLength().ToString(); } if (SnapShotSaves.getCurrentDMG() > 0) { //this.labelDMG.GetComponent<UILabel>().text = SnapShotSaves.getCurrentDMG().ToString(); } else { //this.labelDMG.GetComponent<UILabel>().text = string.Empty; } }
private void setTextureWH() { if (SnapShotSaves.getLength() != 0) { float num = 1.6f; float num2 = ((float)this.texture.GetComponent <UITexture>().mainTexture.width) / ((float)this.texture.GetComponent <UITexture>().mainTexture.height); if (num2 > num) { this.texture.transform.localScale = new Vector3(this.textureW, this.textureW / num2, 0f); this.labelDMG.transform.localPosition = new Vector3((float)((int)((this.textureW * 0.5f) - 20f)), (float)((int)((0f + ((this.textureW * 0.5f) / num2)) - 20f)), -20f); this.labelInfo.transform.localPosition = new Vector3((float)((int)((this.textureW * 0.5f) - 20f)), (float)((int)((0f - ((this.textureW * 0.5f) / num2)) + 20f)), -20f); } else { this.texture.transform.localScale = new Vector3(this.textureH * num2, this.textureH, 0f); this.labelDMG.transform.localPosition = new Vector3((float)((int)(((this.textureH * num2) * 0.5f) - 20f)), (float)((int)((0f + (this.textureH * 0.5f)) - 20f)), -20f); this.labelInfo.transform.localPosition = new Vector3((float)((int)(((this.textureH * num2) * 0.5f) - 20f)), (float)((int)((0f - (this.textureH * 0.5f)) + 20f)), -20f); } } }
private void SetTextureDimensions() { if (SnapShotSaves.GetLength() > 0) { float num = 1.6f; float num2 = (float)texture.GetComponent <UITexture>().mainTexture.width / (float)texture.GetComponent <UITexture>().mainTexture.height; if (num2 > num) { texture.transform.localScale = new Vector3(textureW, textureW / num2, 0f); labelDMG.transform.localPosition = new Vector3((int)(textureW * 0.5f - 20f), (int)(0f + textureW * 0.5f / num2 - 20f), -20f); labelInfo.transform.localPosition = new Vector3((int)(textureW * 0.5f - 20f), (int)(0f - textureW * 0.5f / num2 + 20f), -20f); } else { texture.transform.localScale = new Vector3(textureH * num2, textureH, 0f); labelDMG.transform.localPosition = new Vector3((int)(textureH * num2 * 0.5f - 20f), (int)(0f + textureH * 0.5f - 20f), -20f); labelInfo.transform.localPosition = new Vector3((int)(textureH * num2 * 0.5f - 20f), (int)(0f - textureH * 0.5f + 20f), -20f); } } }
private void setTextureWH() { if (SnapShotSaves.getLength() == 0) { return; } float num = 1.6f; float num2 = (float)this.texture.GetComponent <UITexture>().mainTexture.width / (float)this.texture.GetComponent <UITexture>().mainTexture.height; if (num2 > num) { this.texture.transform.localScale = new Vector3(this.textureW, this.textureW / num2, 0f); this.labelDMG.transform.localPosition = new Vector3((float)((int)(this.textureW * 0.5f - 20f)), (float)((int)(0f + this.textureW * 0.5f / num2 - 20f)), -20f); this.labelInfo.transform.localPosition = new Vector3((float)((int)(this.textureW * 0.5f - 20f)), (float)((int)(0f - this.textureW * 0.5f / num2 + 20f)), -20f); } else { this.texture.transform.localScale = new Vector3(this.textureH * num2, this.textureH, 0f); this.labelDMG.transform.localPosition = new Vector3((float)((int)(this.textureH * num2 * 0.5f - 20f)), (float)((int)(0f + this.textureH * 0.5f - 20f)), -20f); this.labelInfo.transform.localPosition = new Vector3((float)((int)(this.textureH * num2 * 0.5f - 20f)), (float)((int)(0f - this.textureH * 0.5f + 20f)), -20f); } }
public void snapShot2(int index) { Vector3 vector; RaycastHit hit; snapShotCamera.transform.position = head == null ? main_object.transform.position : head.transform.position; var transform = snapShotCamera.transform; transform.position += Vector3.up * heightMulti; var transform2 = snapShotCamera.transform; transform2.position -= Vector3.up * 1.1f; var worldPosition = vector = snapShotCamera.transform.position; var vector3 = (worldPosition + snapShotTargetPosition) * 0.5f; snapShotCamera.transform.position = vector3; worldPosition = vector3; snapShotCamera.transform.LookAt(snapShotTargetPosition); if (index == 3) { snapShotCamera.transform.RotateAround(this.transform.position, Vector3.up, Random.Range(-180f, 180f)); } else { snapShotCamera.transform.RotateAround(this.transform.position, Vector3.up, Random.Range(-20f, 20f)); } snapShotCamera.transform.LookAt(worldPosition); snapShotCamera.transform.RotateAround(worldPosition, this.transform.right, Random.Range(-20f, 20f)); var num = Vector3.Distance(snapShotTargetPosition, vector); if (snapShotTarget != null && snapShotTarget.GetComponent <TITAN>() != null) { num += (index - 1) * snapShotTarget.transform.localScale.x * 10f; } var transform3 = snapShotCamera.transform; transform3.position -= snapShotCamera.transform.forward * Random.Range(num + 3f, num + 10f); snapShotCamera.transform.LookAt(worldPosition); snapShotCamera.transform.RotateAround(worldPosition, this.transform.forward, Random.Range(-30f, 30f)); var end = head == null ? main_object.transform.position : head.transform.position; var vector5 = (head == null ? main_object.transform.position : head.transform.position) - snapShotCamera.transform.position; end -= vector5; LayerMask mask = 1 << LayerMask.NameToLayer("Ground"); LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox"); LayerMask mask3 = mask | mask2; if (head != null) { if (Physics.Linecast(head.transform.position, end, out hit, mask)) { snapShotCamera.transform.position = hit.point; } else if (Physics.Linecast(head.transform.position - vector5 * distanceMulti * 3f, end, out hit, mask3)) { snapShotCamera.transform.position = hit.point; } } else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hit, mask3)) { snapShotCamera.transform.position = hit.point; } switch (index) { case 1: snapshot1 = RTImage(snapShotCamera.GetComponent <Camera>()); SnapShotSaves.addIMG(snapshot1, snapShotDmg); break; case 2: snapshot2 = RTImage(snapShotCamera.GetComponent <Camera>()); SnapShotSaves.addIMG(snapshot2, snapShotDmg); break; case 3: snapshot3 = RTImage(snapShotCamera.GetComponent <Camera>()); SnapShotSaves.addIMG(snapshot3, snapShotDmg); break; } snapShotCount = index; hasSnapShot = true; snapShotCountDown = 2f; if (index == 1) { GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture = snapshot1; GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localScale = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f); GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f); GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.rotation = Quaternion.Euler(0f, 0f, 10f); if (Settings.SnapshotsShowInGameSetting) { GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = true; } else { GameObjectCache.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = false; } } }
public void snapShot2(int index) { uiTextSnap.enabled = false; Vector3 vector; RaycastHit hit; Transform transform = this.snapShotCamera.transform; Transform transform2 = this.main_objectT; Transform transform3 = this.head.transform; transform.position = (this.head == null) ? transform2.position : transform3.position; transform.position += (Vector3)(Vector3.up * this.heightMulti); transform.position -= (Vector3)(Vector3.up * 1.1f); Vector3 worldPosition = vector = transform.position; Vector3 vector3 = (Vector3)((worldPosition + this.snapShotTargetPosition) * 0.5f); transform.position = vector3; worldPosition = vector3; transform.LookAt(this.snapShotTargetPosition); if (index == 3) { transform.RotateAround(this.baseT.position, Vector3.up, UnityEngine.Random.Range((float)-180f, (float)180f)); } else { transform.RotateAround(this.baseT.position, Vector3.up, UnityEngine.Random.Range((float)-20f, (float)20f)); } transform.LookAt(worldPosition); transform.RotateAround(worldPosition, this.baseT.right, UnityEngine.Random.Range((float)-20f, (float)20f)); float num = Vector3.Distance(this.snapShotTargetPosition, vector); if ((this.snapShotTarget != null) && (this.snapShotTarget.GetComponent <TITAN>() != null)) { num += ((index - 1) * transform.localScale.x) * 10f; } transform.position -= (Vector3)(transform.forward * UnityEngine.Random.Range((float)(num + 3f), (float)(num + 10f))); transform.LookAt(worldPosition); transform.RotateAround(worldPosition, this.baseT.forward, UnityEngine.Random.Range((float)-30f, (float)30f)); Vector3 end = (this.head == null) ? transform2.position : transform3.position; Vector3 vector5 = ((this.head == null) ? transform2.position : transform3.position) - transform.position; end -= vector5; LayerMask mask = ((int)1) << LayerMask.NameToLayer("Ground"); LayerMask mask2 = ((int)1) << LayerMask.NameToLayer("EnemyBox"); LayerMask mask3 = mask | mask2; if (this.head != null) { if (Physics.Linecast(transform3.position, end, out hit, (int)mask)) { transform.position = hit.point; } else if (Physics.Linecast(transform3.position - ((Vector3)((vector5 * this.distanceMulti) * 3f)), end, out hit, (int)mask3)) { transform.position = hit.point; } } else if (Physics.Linecast(transform2.position + Vector3.up, end, out hit, (int)mask3)) { transform.position = hit.point; } Camera component = this.snapShotCamera.GetComponent <Camera>(); switch (index) { case 1: this.snapshot1 = this.RTImage2(component); SnapShotSaves.addIMG(this.snapshot1, this.snapShotDmg); break; case 2: this.snapshot2 = this.RTImage2(component); SnapShotSaves.addIMG(this.snapshot2, this.snapShotDmg); break; case 3: this.snapshot3 = this.RTImage2(component); SnapShotSaves.addIMG(this.snapshot3, this.snapShotDmg); break; } this.snapShotCount = index; this.hasSnapShot = true; this.snapShotCountDown = 2f; if (index == 1) { uiTextSnap.mainTexture = this.snapshot1; uiTextSnap.transform.localScale = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f); uiTextSnap.transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f); uiTextSnap.transform.rotation = Quaternion.Euler(0f, 0f, 10f); } }
public void ShowPrevIMG() { this.texture.GetComponent <UITexture>().mainTexture = SnapShotSaves.GetPrevIMG(); this.setTextureWH(); this.freshInfo(); }
public void ShowPreviousImage() { texture.GetComponent <UITexture>().mainTexture = SnapShotSaves.GetPreviousImage(); SetTextureDimensions(); RefreshInfo(); }
public void snapShot2(int index) { Vector3 vector; RaycastHit hit; this.snapShotCamera.transform.position = (this.head == null) ? this.main_object.transform.position : this.head.transform.position; Transform transform = this.snapShotCamera.transform; transform.position += (Vector3)(Vector3.up * this.heightMulti); Transform transform2 = this.snapShotCamera.transform; transform2.position -= (Vector3)(Vector3.up * 1.1f); Vector3 worldPosition = vector = this.snapShotCamera.transform.position; Vector3 vector5 = (Vector3)((worldPosition + this.snapShotTargetPosition) * 0.5f); this.snapShotCamera.transform.position = vector5; worldPosition = vector5; this.snapShotCamera.transform.LookAt(this.snapShotTargetPosition); if (index == 3) { this.snapShotCamera.transform.RotateAround(base.transform.position, Vector3.up, UnityEngine.Random.Range((float)-180f, (float)180f)); } else { this.snapShotCamera.transform.RotateAround(base.transform.position, Vector3.up, UnityEngine.Random.Range((float)-20f, (float)20f)); } this.snapShotCamera.transform.LookAt(worldPosition); this.snapShotCamera.transform.RotateAround(worldPosition, base.transform.right, UnityEngine.Random.Range((float)-20f, (float)20f)); float num = Vector3.Distance(this.snapShotTargetPosition, vector); if ((this.snapShotTarget != null) && (this.snapShotTarget.GetComponent <TITAN>() != null)) { num += ((index - 1) * this.snapShotTarget.transform.localScale.x) * 10f; } Transform transform3 = this.snapShotCamera.transform; transform3.position -= (Vector3)(this.snapShotCamera.transform.forward * UnityEngine.Random.Range((float)(num + 3f), (float)(num + 10f))); this.snapShotCamera.transform.LookAt(worldPosition); this.snapShotCamera.transform.RotateAround(worldPosition, base.transform.forward, UnityEngine.Random.Range((float)-30f, (float)30f)); Vector3 end = (this.head == null) ? this.main_object.transform.position : this.head.transform.position; Vector3 vector4 = ((this.head == null) ? this.main_object.transform.position : this.head.transform.position) - this.snapShotCamera.transform.position; end -= vector4; LayerMask mask = ((int)1) << LayerMask.NameToLayer("Ground"); LayerMask mask2 = ((int)1) << LayerMask.NameToLayer("EnemyBox"); LayerMask mask3 = mask | mask2; if (this.head != null) { if (Physics.Linecast(this.head.transform.position, end, out hit, (int)mask)) { this.snapShotCamera.transform.position = hit.point; } else if (Physics.Linecast(this.head.transform.position - ((Vector3)((vector4 * this.distanceMulti) * 3f)), end, out hit, (int)mask3)) { this.snapShotCamera.transform.position = hit.point; } } else if (Physics.Linecast(this.main_object.transform.position + Vector3.up, end, out hit, (int)mask3)) { this.snapShotCamera.transform.position = hit.point; } switch (index) { case 1: this.snapshot1 = this.RTImage(this.snapShotCamera.GetComponent <Camera>()); SnapShotSaves.addIMG(this.snapshot1, this.snapShotDmg); break; case 2: this.snapshot2 = this.RTImage(this.snapShotCamera.GetComponent <Camera>()); SnapShotSaves.addIMG(this.snapshot2, this.snapShotDmg); break; case 3: this.snapshot3 = this.RTImage(this.snapShotCamera.GetComponent <Camera>()); SnapShotSaves.addIMG(this.snapshot3, this.snapShotDmg); break; } this.snapShotCount = index; this.hasSnapShot = true; this.snapShotCountDown = 2f; if (index == 1) { GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().mainTexture = this.snapshot1; GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localScale = new Vector3(Screen.width * 0.4f, Screen.height * 0.4f, 1f); GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.localPosition = new Vector3(-Screen.width * 0.225f, Screen.height * 0.225f, 0f); GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().transform.rotation = Quaternion.Euler(0f, 0f, 10f); if (PlayerPrefs.HasKey("showSSInGame") && (PlayerPrefs.GetInt("showSSInGame") == 1)) { GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = true; } else { GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>().enabled = false; } } }
public void snapShot2(int index) { snapShotCamera.transform.position = head == null ? main_object.transform.position : head.transform.position; snapShotCamera.transform.position += Vector3.up * heightMulti; snapShotCamera.transform.position -= Vector3.up * 1.1f; Vector3 position; Vector3 a = position = snapShotCamera.transform.position; Vector3 vector = (a + snapShotTargetPosition) * 0.5f; snapShotCamera.transform.position = vector; a = vector; snapShotCamera.transform.LookAt(snapShotTargetPosition); if (index == 3) { snapShotCamera.transform.RotateAround(base.transform.position, Vector3.up, Random.Range(-180f, 180f)); } else { snapShotCamera.transform.RotateAround(base.transform.position, Vector3.up, Random.Range(-20f, 20f)); } snapShotCamera.transform.LookAt(a); snapShotCamera.transform.RotateAround(a, base.transform.right, Random.Range(-20f, 20f)); float num = Vector3.Distance(snapShotTargetPosition, position); if (snapShotTarget != null && (bool)snapShotTarget.GetComponent <TITAN>()) { float num2 = num; float num3 = index - 1; vector = snapShotTarget.transform.localScale; num = num2 + num3 * vector.x * 10f; } snapShotCamera.transform.position -= snapShotCamera.transform.forward * Random.Range(num + 3f, num + 10f); snapShotCamera.transform.LookAt(a); snapShotCamera.transform.RotateAround(a, base.transform.forward, Random.Range(-30f, 30f)); Vector3 end = head == null ? main_object.transform.position : head.transform.position; Vector3 vector2 = (head == null ? main_object.transform.position : head.transform.position) - snapShotCamera.transform.position; end -= vector2; LayerMask mask = 1 << LayerMask.NameToLayer("Ground"); LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox"); LayerMask mask3 = (int)mask | (int)mask2; RaycastHit hitInfo; if (head != null) { if (Physics.Linecast(head.transform.position, end, out hitInfo, mask)) { snapShotCamera.transform.position = hitInfo.point; } else if (Physics.Linecast(head.transform.position - vector2 * distanceMulti * 3f, end, out hitInfo, mask3)) { snapShotCamera.transform.position = hitInfo.point; } } else if (Physics.Linecast(main_object.transform.position + Vector3.up, end, out hitInfo, mask3)) { snapShotCamera.transform.position = hitInfo.point; } switch (index) { case 1: snapshot1 = RTImage2(snapShotCamera.GetComponent <Camera>()); SnapShotSaves.AddImage(snapshot1, snapShotDmg); break; case 2: snapshot2 = RTImage2(snapShotCamera.GetComponent <Camera>()); SnapShotSaves.AddImage(snapshot2, snapShotDmg); break; case 3: snapshot3 = RTImage2(snapShotCamera.GetComponent <Camera>()); SnapShotSaves.AddImage(snapshot3, snapShotDmg); break; } snapShotCount = index; hasSnapShot = true; snapShotCountDown = 2f; if (index == 1) { UITexture uiTexture1 = GameObject.Find("UI_IN_GAME").GetComponent <UIReferArray>().panels[0].transform.Find("snapshot1").GetComponent <UITexture>(); uiTexture1.mainTexture = snapshot1; uiTexture1.transform.localScale = new Vector3((float)Screen.width * 0.4f, (float)Screen.height * 0.4f, 1f); uiTexture1.transform.localPosition = new Vector3((float)(-Screen.width) * 0.225f, (float)Screen.height * 0.225f, 0f); uiTexture1.transform.rotation = Quaternion.Euler(0f, 0f, 10f); if (PlayerPrefs.HasKey("showSSInGame") && PlayerPrefs.GetInt("showSSInGame") == 1) { uiTexture1.enabled = true; } else { uiTexture1.enabled = false; } } }
public void ShowNextIMG() { texture.GetComponent <UITexture>().mainTexture = SnapShotSaves.GetNextIMG(); setTextureWH(); freshInfo(); }