public void Show(BattleStatView.ChartView.ChartType chartType, SampleData data, CUIFormScript form) { this.root.CustomSetActive(true); string text = chartType.ToString(); this.title.text = Singleton <CTextManager> .GetInstance().GetText(text + "_Title"); this.bannerExp.CustomSetActive(chartType == BattleStatView.ChartView.ChartType.ExpTrend); this.bannerMoney.CustomSetActive(chartType == BattleStatView.ChartView.ChartType.MoneyTrend); this.camp1Data.text = data.curDataLeft.ToString(); this.camp2Data.text = data.curDataRight.ToString(); float num = (data.count <= 1) ? 1f : (data.step * (float)(data.count - 1)); int num2 = Mathf.CeilToInt(num / 4f); for (int i = 0; i <= 4; i++) { int num3 = i * num2; this.xAxis[i].text = string.Format("{0:D2}:{1:D2}", num3 / 60, num3 % 60); } int num4 = Math.Max(Math.Abs(data.min), Math.Abs(data.max)); int num5 = Mathf.CeilToInt((float)num4 / 5f); bool flag = num5 % 100 == 0; num5 /= 100; if (!flag) { num5++; } if (num5 < 1) { num5 = 1; } num5 *= 100; int num6 = 4; for (int j = 1; j <= num6; j++) { string text2 = "+" + num5 * j; this.yAxis[num6 + j].text = text2; this.yAxis[num6 - j].text = text2; } RectTransform component = this.drawArea.GetComponent <RectTransform>(); Vector3 vector = CUIUtility.WorldToScreenPoint(form.GetCamera(), component.position); float num7 = form.ChangeFormValueToScreen(component.rect.width); float num8 = form.ChangeFormValueToScreen(component.rect.height); vector.x -= num7 * 0.5f; float num9 = num7 / (float)(num2 * 4); float num10 = num8 * 0.5f / (float)(num5 * 5); Vector3[] array = new Vector3[data.count]; for (int k = 0; k < data.count; k++) { array[k] = new Vector3(vector.x + data.step * (float)k * num9, vector.y + (float)data[k] * num10); } this.drawArea.color = ((chartType != BattleStatView.ChartView.ChartType.ExpTrend) ? Color.yellow : Color.green); this.drawArea.thickness = 2f; this.drawArea.drawSpeed = 1000f; this.drawArea.SetVertexs(array); }
public bool IsInsideRect(CUIFormScript form, GameObject obj, ref Vector2 screenPosition) { if (form == null || obj == null) { return(false); } Vector2 vector = CUIUtility.WorldToScreenPoint(form.GetCamera(), obj.transform.position); float num = form.ChangeFormValueToScreen((obj.transform as RectTransform).sizeDelta.x); float num2 = form.ChangeFormValueToScreen((obj.transform as RectTransform).sizeDelta.y); Rect rect = new Rect(vector.x - num / 2f, vector.y - num2 / 2f, num, num2); return(rect.Contains(screenPosition)); }
public static void UpdateGuideTextPos(NewbieGuideSpecialTipConf tipConf, GameObject inParentObj, CUIFormScript inGuideForm, CUIFormScript inOriginalForm, GameObject rootPanel) { if (tipConf == null || inParentObj == null || inGuideForm == null || inOriginalForm == null) { return; } RectTransform rectTransform = (RectTransform)rootPanel.transform.FindChild("RightSpecial").transform; RectTransform rectTransform2 = (RectTransform)rootPanel.transform; Vector3 position = inParentObj.transform.position; Vector2 vector = CUIUtility.WorldToScreenPoint(inOriginalForm.GetCamera(), position); float num = vector.x; float num2 = vector.y; float num3 = 142f; float num4 = 85f; Vector2 vector2 = new Vector2(0f, 0f); switch (tipConf.bSpecialTipPos) { case 0: vector2 = new Vector2(-num3, num4); break; case 1: vector2 = new Vector2(-num3, -num4); break; case 2: vector2 = new Vector2(num3, num4); break; case 3: vector2 = new Vector2(num3, -num4); break; } if (tipConf.iOffsetX != 0) { vector2.x += (float)tipConf.iOffsetX; } if (tipConf.iOffsetY != 0) { vector2.y += (float)tipConf.iOffsetY; } vector2.x = inGuideForm.ChangeFormValueToScreen(vector2.x); vector2.y = inGuideForm.ChangeFormValueToScreen(vector2.y); rectTransform2.sizeDelta = rectTransform.sizeDelta; float num5 = rectTransform2.rect.width / 2f; num5 = inGuideForm.ChangeFormValueToScreen(num5); num5 += 3f; float num6 = rectTransform2.rect.height / 2f; num6 = inGuideForm.ChangeFormValueToScreen(num6); num6 += 3f; num += vector2.x; num2 += vector2.y; if (num < num5) { num = num5; } else if (num + num5 > (float)Screen.width) { num = (float)Screen.width - num5; } if (num2 < num6) { num2 = num6; } else if (num2 + num6 > (float)Screen.height) { num2 = (float)Screen.height - num6; } num = inGuideForm.ChangeScreenValueToForm(num); num2 = inGuideForm.ChangeScreenValueToForm(num2); rectTransform2.anchoredPosition = new Vector2(num, num2); }
public static void UpdateGuideTextPos(NewbieGuideSpecialTipConf tipConf, GameObject inParentObj, CUIFormScript inGuideForm, CUIFormScript inOriginalForm, GameObject rootPanel) { if (((tipConf != null) && (inParentObj != null)) && ((inGuideForm != null) && (inOriginalForm != null))) { CUIFormScript script = inGuideForm; RectTransform transform = (RectTransform)rootPanel.transform.FindChild("RightSpecial").transform; RectTransform transform2 = (RectTransform)rootPanel.transform; Vector3 position = inParentObj.transform.position; Vector2 vector2 = CUIUtility.WorldToScreenPoint(inOriginalForm.GetCamera(), position); float x = vector2.x; float y = vector2.y; float num3 = 142f; float num4 = 85f; Vector2 vector3 = new Vector2(0f, 0f); switch (tipConf.bSpecialTipPos) { case 0: vector3 = new Vector2(-num3, num4); break; case 1: vector3 = new Vector2(-num3, -num4); break; case 2: vector3 = new Vector2(num3, num4); break; case 3: vector3 = new Vector2(num3, -num4); break; } if (tipConf.iOffsetX != 0) { vector3.x += tipConf.iOffsetX; } if (tipConf.iOffsetY != 0) { vector3.y += tipConf.iOffsetY; } float num5 = Mathf.Max(transform2.rect.width, transform.rect.width) / 2f; num5 = script.ChangeFormValueToScreen(num5) + 3f; float num6 = Mathf.Max(transform2.rect.height, transform.rect.height) / 2f; num6 = script.ChangeFormValueToScreen(num6) + 3f; x += vector3.x; y += vector3.y; if (x < num5) { x = num5; } else if ((x + num5) > Screen.width) { x = Screen.width - num5; } if (y < num6) { y = num6; } else if ((y + num6) > Screen.height) { y = Screen.height - num6; } x = script.ChangeScreenValueToForm(x); y = script.ChangeScreenValueToForm(y); transform2.anchoredPosition = new Vector2(x, y); } }