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 static void ShowSwapMsg(int totalSec, COM_PLAYERCAMP camp = COM_PLAYERCAMP.COM_PLAYERCAMP_1, int pos = 0) { if (totalSec > 0) { CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(CRoomSystem.PATH_ROOM_SWAP, false, true); if (cUIFormScript == null || cUIFormScript.gameObject == null) { return; } GameObject gameObject = Utility.FindChild(cUIFormScript.gameObject, "SwapMessageBox"); CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CRoomSystem.PATH_ROOM); if (form == null || form.gameObject == null) { return; } GameObject gameObject2; if (camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) { gameObject2 = Utility.FindChild(form.gameObject, string.Format("Panel_Main/LeftPlayers/Left_Player{0}", pos + 1)); } else if (camp == COM_PLAYERCAMP.COM_PLAYERCAMP_2) { gameObject2 = Utility.FindChild(form.gameObject, string.Format("Panel_Main/RightPlayers/Right_Player{0}", pos + 1)); } else { gameObject2 = Utility.FindChild(form.gameObject, "Panel_Main/Observers"); } if (gameObject2 == null) { return; } gameObject.CustomSetActive(true); Vector2 vector = CUIUtility.WorldToScreenPoint(form.GetCamera(), gameObject2.transform.position); Vector3 position = CUIUtility.ScreenToWorldPoint(cUIFormScript.GetCamera(), vector, gameObject.transform.position.z); gameObject.transform.position = position; vector = default(Vector2); vector = (gameObject.transform as RectTransform).anchoredPosition; vector.y += (float)((camp == COM_PLAYERCAMP.COM_PLAYERCAMP_MID) ? -20 : 28); (gameObject.transform as RectTransform).anchoredPosition = vector; CUITimerScript component = gameObject.GetComponent <CUITimerScript>(); component.SetTotalTime((float)totalSec); component.m_eventIDs[0] = enUIEventID.Room_ChangePos_Box_TimerChange; component.m_eventIDs[2] = enUIEventID.Room_ChangePos_Box_TimerChange; component.m_eventIDs[1] = enUIEventID.Room_ChangePos_TimeUp; component.m_eventParams[0].tag = pos; component.m_eventParams[0].tag2 = (int)camp; component.m_eventParams[2].tag = pos; component.m_eventParams[2].tag2 = (int)camp; component.ReStartTimer(); } else { Singleton <CUIManager> .GetInstance().CloseForm(CRoomSystem.PATH_ROOM_SWAP); } }
public UIParticleInfo AddParticle(string parPath, float playTime, GameObject targetLoc, CUIFormScript targetFormScript) { if (targetLoc == null || targetFormScript == null) { return(null); } Vector2 sreenLoc = CUIUtility.WorldToScreenPoint(targetFormScript.GetCamera(), targetLoc.transform.position); return(this.AddParticle(parPath, playTime, sreenLoc)); }
public void Init(CUIFormScript formScript, GameObject minimapGameObject, GameObject signalSrcHeroNameContainer, bool useSignalButton) { if (formScript == null) { return; } this.m_formScript = formScript; this.m_miniMap = minimapGameObject; if (this.m_miniMap != null) { this.m_miniMapScreenPosition = CUIUtility.WorldToScreenPoint(formScript.GetCamera(), this.m_miniMap.transform.position); } this.m_signalSrcHeroNameContainer = ((signalSrcHeroNameContainer == null) ? null : signalSrcHeroNameContainer.GetComponent <CUIContainerScript>()); this.m_signalTipsList = SignalPanel.GetSignalTipsListScript(); if (this.m_signalTipsList != null) { this.m_signalTipsListCanvasGroup = this.m_signalTipsList.gameObject.GetComponent <CanvasGroup>(); if (this.m_signalTipsListCanvasGroup == null) { this.m_signalTipsListCanvasGroup = this.m_signalTipsList.gameObject.AddComponent <CanvasGroup>(); } this.m_signalTipsListCanvasGroup.alpha = 0f; this.m_signalTipsListCanvasGroup.blocksRaycasts = false; } this.m_useSignalButton = useSignalButton; this.m_signalButtons = new CSignalButton[SignalPanel.s_signalButtonInfos.Length]; for (int i = 0; i < this.m_signalButtons.Length; i++) { this.m_signalButtons[i] = new CSignalButton(this.m_formScript.GetWidget(SignalPanel.s_signalButtonInfos[i][1]), SignalPanel.s_signalButtonInfos[i][0]); this.m_signalButtons[i].Initialize(this.m_formScript); if (!useSignalButton) { this.m_signalButtons[i].Disable(); } } if (this.m_useSignalButton) { Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_ClickMiniMap, new CUIEventManager.OnUIEventHandler(this.OnClickMiniMap)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_Click_Scene, new CUIEventManager.OnUIEventHandler(this.OnClickBattleScene)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_OnSignalButtonClicked, new CUIEventManager.OnUIEventHandler(this.OnSignalButtonClicked)); Singleton <CUIEventManager> .GetInstance().AddUIEventListener(enUIEventID.Battle_OnSignalTipsListElementEnable, new CUIEventManager.OnUIEventHandler(this.OnSignalListElementEnabled)); this.m_battleSceneGroundPlane = new Plane(new Vector3(0f, 1f, 0f), 0.15f); this.m_signals = new ListView <CSignal>(); this.m_playerSignalCooldowns = new Dictionary <uint, SignalPanel.CPlayerSignalCooldown>(); this.m_signalTipses = new ListView <CSignalTipsElement>(); } Singleton <GameEventSys> .instance.AddEventHandler <SpawnSoldierParam>(GameEventDef.Event_SpawnSoldier, new RefAction <SpawnSoldierParam>(this.OnSpawnSoldier)); }
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 void HighliterForActorClickHandler(CUIEvent uiEvt) { GameObject srcWidget = uiEvt.m_srcWidget; Singleton <CBattleGuideManager> .GetInstance().ResumeGame(srcWidget); CUIFormScript formGuideMask = NewbieGuideScriptControl.FormGuideMask; Vector2 screenPos = CUIUtility.WorldToScreenPoint(formGuideMask.GetCamera(), srcWidget.transform.position); Singleton <LockModeScreenSelector> .GetInstance().OnClickBattleScene(screenPos); CUICommonSystem.DestoryObj(srcWidget, 0.1f); NewbieGuideScriptControl.CloseGuideForm(); }
protected virtual void Update() { CUIFormScript formGuideMask = NewbieGuideScriptControl.FormGuideMask; if ((ms_originalForm != null) && (formGuideMask != null)) { int count = ms_highlitGo.Count; DebugHelper.Assert(count <= ms_originalGo.Count); for (int i = 0; i < count; i++) { GameObject obj2 = ms_highlitGo[i]; GameObject inParentObj = ms_originalGo[i]; if ((obj2 != null) && (inParentObj != null)) { obj2.CustomSetActive(inParentObj.activeSelf); RectTransform transform = obj2.transform as RectTransform; RectTransform transform2 = inParentObj.transform as RectTransform; transform.localScale = transform2.localScale; transform.pivot = transform2.pivot; transform.sizeDelta = transform2.sizeDelta; LayoutElement component = transform2.GetComponent <LayoutElement>(); if ((component != null) && (transform.sizeDelta == Vector2.zero)) { transform.sizeDelta = new Vector2(component.preferredWidth, component.preferredHeight); } transform.position = transform2.position; Vector2 screenPoint = CUIUtility.WorldToScreenPoint(ms_originalForm.GetCamera(), transform2.position); Vector3 vector2 = CUIUtility.ScreenToWorldPoint(NewbieGuideScriptControl.FormGuideMask.GetCamera(), screenPoint, transform.position.z); if (i < ms_guideTextList.Count) { NewbieGuideSpecialTipConf specialTipConfig = Singleton <NewbieGuideDataManager> .GetInstance().GetSpecialTipConfig(this.currentConf.wSpecialTip); if ((specialTipConfig != null) && (specialTipConfig.bGuideTextPos > 0)) { ms_guideTextList[i].CustomSetActive(obj2.activeSelf); UpdateGuideTextPos(specialTipConfig, inParentObj, formGuideMask, ms_originalForm, ms_guideTextList[i]); } } } } } }
public void AddHighlightForActor(PoolObjHandle <ActorRoot> actor, bool bPauseGame) { if (!actor) { return; } ActorRoot handle = actor.get_handle(); if (!handle.InCamera) { return; } GameObject gameObject = Singleton <CResourceManager> .GetInstance().GetResource("UGUI/Form/System/Dialog/WeakGuideHighlighter.prefab", typeof(GameObject), 4, false, false).m_content as GameObject; if (gameObject != null) { GameObject gameObject2 = Object.Instantiate(gameObject) as GameObject; if (gameObject2 != null) { if (NewbieGuideScriptControl.FormGuideMask == null) { NewbieGuideScriptControl.OpenGuideForm(); } CUIFormScript formGuideMask = NewbieGuideScriptControl.FormGuideMask; Transform transform = formGuideMask.transform; Vector3 v = CUIUtility.WorldToScreenPoint(Camera.main, (Vector3)handle.location); Vector3 vector = CUIUtility.ScreenToWorldPoint(formGuideMask.GetCamera(), v, transform.position.z); Transform transform2 = gameObject2.transform; transform2.SetSiblingIndex(1); transform2.SetParent(NewbieGuideScriptControl.FormGuideMask.transform); formGuideMask.InitializeWidgetPosition(gameObject2, vector); transform2.position = vector; transform2.localScale = Vector3.one; CUIEventScript cUIEventScript = gameObject2.AddComponent <CUIEventScript>(); CUIEventScript expr_117 = cUIEventScript; expr_117.onClick = (CUIEventScript.OnUIEventHandler)Delegate.Combine(expr_117.onClick, new CUIEventScript.OnUIEventHandler(this.HighliterForActorClickHandler)); Singleton <CBattleGuideManager> .GetInstance().PauseGame(gameObject2, false); } } }
public void Move_CameraToClickPosition(CUIEvent uiEvent) { if (MonoSingleton <CameraSystem> .GetInstance().enableLockedCamera) { MonoSingleton <CameraSystem> .instance.ToggleFreeDragCamera(true); if (Singleton <CBattleSystem> .GetInstance().WatchForm != null) { Singleton <CBattleSystem> .GetInstance().WatchForm.OnCamerFreed(); } } CUIFormScript srcFormScript = uiEvent.m_srcFormScript; if (((srcFormScript != null) && (uiEvent.m_srcWidget != null)) && (uiEvent.m_pointerEventData != null)) { Vector2 position = uiEvent.m_pointerEventData.position; Vector2 vector2 = CUIUtility.WorldToScreenPoint(srcFormScript.GetCamera(), uiEvent.m_srcWidget.transform.position); float num = position.x - vector2.x; float num2 = position.y - vector2.y; num = uiEvent.m_srcFormScript.ChangeScreenValueToForm(num); num2 = uiEvent.m_srcFormScript.ChangeScreenValueToForm(num2); float x = num * Singleton <CBattleSystem> .instance.UI_world_Factor_Small.x; float z = num2 * Singleton <CBattleSystem> .instance.UI_world_Factor_Small.y; if (MonoSingleton <CameraSystem> .instance.MobaCamera != null) { MonoSingleton <CameraSystem> .instance.MobaCamera.SetAbsoluteLockLocation(new Vector3(x, 1f, z)); if (this.m_miniMapCameraFrame != null) { if (!this.m_miniMapCameraFrame.IsCameraFrameShow) { this.m_miniMapCameraFrame.Show(); this.m_miniMapCameraFrame.ShowNormal(); } this.m_miniMapCameraFrame.SetPos(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) { 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); }
private void AddHighlightInternal(GameObject baseGo, CUIFormScript inOriginalForm, bool cloneEvent, bool bShowFinger) { this.PreHighlight(); if (baseGo != null) { NewbieGuideBaseScript.ms_originalGo.Add(baseGo); } NewbieGuideBaseScript.ms_originalForm = inOriginalForm; this.OpenGuideForm(); if (NewbieGuideScriptControl.FormGuideMask == null) { NewbieGuideScriptControl.OpenGuideForm(); } List <GameObject> .Enumerator enumerator = NewbieGuideBaseScript.ms_originalGo.GetEnumerator(); int num = 0; while (enumerator.MoveNext()) { GameObject current = enumerator.get_Current(); if (!(current == null)) { GameObject gameObject = Object.Instantiate(current) as GameObject; if (!(gameObject == null)) { RectTransform rectTransform = gameObject.transform as RectTransform; rectTransform.SetParent(NewbieGuideScriptControl.FormGuideMask.transform); rectTransform.SetSiblingIndex(1); rectTransform.localScale = current.transform.localScale; RectTransform rectTransform2 = current.transform as RectTransform; rectTransform.pivot = rectTransform2.pivot; rectTransform.sizeDelta = rectTransform2.sizeDelta; LayoutElement component = current.GetComponent <LayoutElement>(); if (component != null && rectTransform.sizeDelta == Vector2.zero) { rectTransform.sizeDelta = new Vector2(component.get_preferredWidth(), component.get_preferredHeight()); } rectTransform.position = current.transform.position; Vector2 screenPoint = CUIUtility.WorldToScreenPoint(inOriginalForm.GetCamera(), current.transform.position); Vector3 worldPosition = CUIUtility.ScreenToWorldPoint(NewbieGuideScriptControl.FormGuideMask.GetCamera(), screenPoint, rectTransform.position.z); NewbieGuideScriptControl.FormGuideMask.InitializeWidgetPosition(gameObject, worldPosition); gameObject.CustomSetActive(false); if (cloneEvent) { CUIEventScript component2 = current.GetComponent <CUIEventScript>(); CUIEventScript component3 = gameObject.GetComponent <CUIEventScript>(); if (component2 && component3) { component3.m_onDownEventParams = component2.m_onDownEventParams; component3.m_onUpEventParams = component2.m_onUpEventParams; component3.m_onClickEventParams = component2.m_onClickEventParams; component3.m_onHoldStartEventParams = component2.m_onHoldStartEventParams; component3.m_onHoldEventParams = component2.m_onHoldEventParams; component3.m_onHoldEndEventParams = component2.m_onHoldEndEventParams; component3.m_onDragStartEventParams = component2.m_onDragStartEventParams; component3.m_onDragEventParams = component2.m_onDragEventParams; component3.m_onDragEndEventParams = component2.m_onDragEndEventParams; component3.m_onDropEventParams = component2.m_onDropEventParams; component3.m_closeFormWhenClicked = component2.m_closeFormWhenClicked; component3.m_belongedFormScript = component2.m_belongedFormScript; component3.m_belongedListScript = component2.m_belongedListScript; component3.m_indexInlist = component2.m_indexInlist; } CUIMiniEventScript component4 = current.GetComponent <CUIMiniEventScript>(); CUIMiniEventScript component5 = gameObject.GetComponent <CUIMiniEventScript>(); if (component4 && component5) { component5.m_onDownEventParams = component4.m_onDownEventParams; component5.m_onUpEventParams = component4.m_onUpEventParams; component5.m_onClickEventParams = component4.m_onClickEventParams; component5.m_closeFormWhenClicked = component4.m_closeFormWhenClicked; component5.m_belongedFormScript = component4.m_belongedFormScript; component5.m_belongedListScript = component4.m_belongedListScript; component5.m_indexInlist = component4.m_indexInlist; } } else { CUIEventScript component6 = gameObject.GetComponent <CUIEventScript>(); if (component6) { component6.enabled = false; } CUIMiniEventScript component7 = gameObject.GetComponent <CUIMiniEventScript>(); if (component7) { component7.enabled = false; } } gameObject.CustomSetActive(true); CUIAnimatorScript component8 = current.GetComponent <CUIAnimatorScript>(); if (component8 != null) { CUICommonSystem.PlayAnimator(gameObject, component8.m_currentAnimatorStateName); } NewbieGuideBaseScript.ms_highlitGo.Add(gameObject); if (bShowFinger) { GameObject gameObject2 = Singleton <CResourceManager> .GetInstance().GetResource("UGUI/Form/System/Dialog/WeakGuideHighlighter.prefab", typeof(GameObject), enResourceType.UIPrefab, false, false).m_content as GameObject; if (gameObject2 != null) { GameObject gameObject3 = Object.Instantiate(gameObject2) as GameObject; if (gameObject3 != null) { gameObject3.transform.SetParent(gameObject.transform); Transform transform = gameObject3.transform; switch (this.currentConf.wFlipType) { case 0: transform.localScale = NewbieGuideBaseScript.s_FlipNone; break; case 1: transform.localScale = NewbieGuideBaseScript.s_FlipX; break; case 2: transform.localScale = NewbieGuideBaseScript.s_FlipY; break; case 3: transform.localScale = NewbieGuideBaseScript.s_FlipXY; break; } gameObject3.transform.position = gameObject.transform.position; (gameObject3.transform as RectTransform).anchoredPosition = new Vector2((float)this.currentConf.iOffsetHighLightX, (float)this.currentConf.iOffsetHighLightY); if (!this.DoesShowArrow()) { gameObject3.transform.FindChild("Panel/ImageFinger").gameObject.CustomSetActive(false); } NewbieGuideBaseScript.ms_highlighter.Add(gameObject3); } } } if (num == 0 && this.currentConf.wSpecialTip != 0) { NewbieGuideSpecialTipConf specialTipConfig = Singleton <NewbieGuideDataManager> .GetInstance().GetSpecialTipConfig((uint)this.currentConf.wSpecialTip); if (specialTipConfig != null && specialTipConfig.bGuideTextPos > 0) { GameObject gameObject4 = NewbieGuideBaseScript.InstantiateGuideText(specialTipConfig, gameObject, NewbieGuideScriptControl.FormGuideMask, inOriginalForm); if (gameObject4 != null) { NewbieGuideBaseScript.ms_guideTextList.Add(gameObject4); gameObject4.CustomSetActive(false); } } } num++; } } } }
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); } }
private void OnPlayerInfoSystemRecivedMsg(CSPkg msg) { if (msg.stPkgData.stGetAcntDetailInfoRsp.iErrCode != 0) { Singleton <CUIManager> .GetInstance().OpenMessageBox(string.Format("Error Code {0}", msg.stPkgData.stGetAcntDetailInfoRsp.iErrCode), false); return; } this.m_BackPlayeInfoMsg = msg; this.m_PlayerProfile.ConvertServerDetailData(msg.stPkgData.stGetAcntDetailInfoRsp.stAcntDetail.stOfSucc); CUIFormScript cUIFormScript = Singleton <CUIManager> .GetInstance().OpenForm(CMiniPlayerInfoSystem.sPlayerInfoFormPath, false, true); if (cUIFormScript == null) { return; } if (this.m_bUp) { cUIFormScript.SetPriority(enFormPriority.Priority5); } else { cUIFormScript.RestorePriority(); } GameObject widget = cUIFormScript.GetWidget(0); RectTransform rectTransform = cUIFormScript.transform.Find("panel") as RectTransform; if (rectTransform == null) { Debug.LogError("mini player info form's panel is null"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); } CMiniPlayerInfoSystem.OpenSrc openSrc = this.m_OpenSrc; if (openSrc != CMiniPlayerInfoSystem.OpenSrc.Rank) { if (openSrc == CMiniPlayerInfoSystem.OpenSrc.Chat) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CChatController.ChatFormPath); if (form == null) { Debug.LogError("can't get chat form"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } RectTransform rectTransform2 = form.transform.Find("node/null") as RectTransform; if (rectTransform2 == null) { Debug.LogError("chat form's close btn is null"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } widget.CustomSetActive(true); Vector3[] array = new Vector3[4]; rectTransform2.GetWorldCorners(array); Vector2 vector = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array[3]); Vector2 screenPoint = new Vector2(0f, vector.y); Vector3[] array2 = new Vector3[4]; rectTransform.GetWorldCorners(array2); float num = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array2[3]).x - CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array2[0]).x; if (vector.x + num + 100f > (float)Screen.width) { screenPoint.x = (float)Screen.width - num - 15f; } else { screenPoint = new Vector2(vector.x + 20f, vector.y); } rectTransform.position = CUIUtility.ScreenToWorldPoint(cUIFormScript.GetCamera(), screenPoint, rectTransform.position.z); } } else { CUIFormScript form2 = Singleton <CUIManager> .GetInstance().GetForm(RankingSystem.s_rankingForm); if (form2 == null) { Debug.LogError("can't get ranking form"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } RectTransform rectTransform3 = form2.transform.Find("bg") as RectTransform; if (rectTransform3 == null) { Debug.LogError("ranking form's bg is null"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } widget.CustomSetActive(true); Vector3[] array3 = new Vector3[4]; rectTransform3.GetWorldCorners(array3); Vector2 vector2 = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array3[2]); Vector2 screenPoint2 = new Vector2(0f, vector2.y - 100f); Vector3[] array4 = new Vector3[4]; rectTransform.GetWorldCorners(array4); float num2 = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array4[3]).x - CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, array4[0]).x; if (vector2.x + 80f + num2 > (float)Screen.width) { screenPoint2.x = (float)Screen.width - num2 - 15f; } else { screenPoint2.x = vector2.x + 80f; } rectTransform.position = CUIUtility.ScreenToWorldPoint(cUIFormScript.GetCamera(), screenPoint2, rectTransform.position.z); } Text componetInChild = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Name/Text"); if (componetInChild != null) { componetInChild.set_text(this.m_PlayerProfile.Name()); } COMDT_FRIEND_INFO info = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.GameFriend, this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld); COMDT_FRIEND_INFO info2 = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.SNS, this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld); Text componetInChild2 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Online/Text"); if (componetInChild2 != null) { if (this.m_PlayerProfile.IsOnLine()) { COMDT_FRIEND_INFO cOMDT_FRIEND_INFO = (info == null) ? ((info2 == null) ? null : info2) : info; if (cOMDT_FRIEND_INFO != null) { COM_ACNT_GAME_STATE friendInGamingState = Singleton <CFriendContoller> .instance.model.GetFriendInGamingState(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld); if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_IDLE) { componetInChild2.set_text(string.Format("<color=#00ff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Online"))); } else if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_SINGLEGAME || friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_MULTIGAME) { componetInChild2.set_text(string.Format("<color=#ffff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Gaming"))); } else if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_TEAM) { componetInChild2.set_text(string.Format("<color=#ffff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Teaming"))); } } else { componetInChild2.set_text(string.Format("<color=#00ff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Online"))); } } else { Text text = componetInChild2; string text2 = Singleton <CTextManager> .GetInstance().GetText("Common_Offline"); componetInChild2.set_text(text2); text.set_text(text2); } } Text componetInChild3 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/DuanWei/Text"); if (componetInChild3 != null) { string rankName = CLadderView.GetRankName(this.m_PlayerProfile.GetRankGrade(), (uint)this.m_PlayerProfile.GetRankClass()); componetInChild3.set_text(string.IsNullOrEmpty(rankName) ? Singleton <CTextManager> .GetInstance().GetText("Common_NoData") : rankName); } Text componetInChild4 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Team/Text"); Text componetInChild5 = Utility.GetComponetInChild <Text>(cUIFormScript.gameObject, "panel/Position/Text"); if (!CGuildSystem.IsInNormalGuild(this.m_PlayerProfile.GuildState) || string.IsNullOrEmpty(this.m_PlayerProfile.GuildName)) { if (componetInChild4 != null) { componetInChild4.set_text(Singleton <CTextManager> .GetInstance().GetText("PlayerInfo_Guild")); } if (componetInChild5 != null) { componetInChild5.set_text(Singleton <CTextManager> .GetInstance().GetText("PlayerInfo_Guild")); } } else { if (componetInChild4 != null) { componetInChild4.set_text(this.m_PlayerProfile.GuildName); } if (componetInChild5 != null) { componetInChild5.set_text(CGuildHelper.GetPositionName(this.m_PlayerProfile.GuildState)); } } GameObject obj = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/AddFriend"); GameObject obj2 = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/Profile"); GameObject obj3 = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/3v3"); GameObject obj4 = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/5v5"); GameObject gameObject = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/Block"); GameObject obj5 = Utility.FindChild(cUIFormScript.gameObject, "panel/Btn/Complaints"); obj5.CustomSetActive(false); obj2.CustomSetActive(true); openSrc = this.m_OpenSrc; if (openSrc != CMiniPlayerInfoSystem.OpenSrc.Rank) { if (openSrc == CMiniPlayerInfoSystem.OpenSrc.Chat) { switch (Singleton <CChatController> .GetInstance().view.CurTab) { case EChatChannel.Lobby: case EChatChannel.GuildMatchTeam: obj3.CustomSetActive(false); obj4.CustomSetActive(false); if (info != null || info2 != null) { obj.CustomSetActive(false); } else { obj.CustomSetActive(true); } gameObject.CustomSetActive(true); obj5.CustomSetActive(false); this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); break; case EChatChannel.Guild: if (info != null || info2 != null) { obj.CustomSetActive(false); obj3.CustomSetActive(true); obj4.CustomSetActive(true); } else { obj.CustomSetActive(true); obj3.CustomSetActive(false); obj4.CustomSetActive(false); } gameObject.CustomSetActive(true); obj5.CustomSetActive(false); this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); break; case EChatChannel.Friend_Chat: obj.CustomSetActive(false); obj3.CustomSetActive(true); obj4.CustomSetActive(true); gameObject.CustomSetActive(true); obj5.CustomSetActive(false); this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); break; case EChatChannel.Settle: obj.CustomSetActive(false); obj3.CustomSetActive(false); obj4.CustomSetActive(false); gameObject.CustomSetActive(true); obj5.CustomSetActive(false); this.SetBlockButtonBlocked(gameObject, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); break; } } } else { if (info != null || info2 != null) { obj.CustomSetActive(false); obj3.CustomSetActive(true); obj4.CustomSetActive(true); } else { obj.CustomSetActive(true); obj3.CustomSetActive(false); obj4.CustomSetActive(false); } gameObject.CustomSetActive(false); obj5.CustomSetActive(false); } }
private void OnPlayerInfoSystemRecivedMsg(CSPkg msg) { Text text3; if (msg.stPkgData.stGetAcntDetailInfoRsp.iErrCode != 0) { Singleton <CUIManager> .GetInstance().OpenMessageBox(string.Format("Error Code {0}", msg.stPkgData.stGetAcntDetailInfoRsp.iErrCode), false); return; } this.m_BackPlayeInfoMsg = msg; this.m_PlayerProfile.ConvertServerDetailData(msg.stPkgData.stGetAcntDetailInfoRsp.stAcntDetail.stOfSucc); CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(sPlayerInfoFormPath, false, true); if (script == null) { return; } if (this.m_bUp) { script.SetPriority(enFormPriority.Priority5); } else { script.RestorePriority(); } GameObject widget = script.GetWidget(0); RectTransform transform = script.transform.Find("panel") as RectTransform; if (transform == null) { Debug.LogError("mini player info form's panel is null"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); } OpenSrc openSrc = this.m_OpenSrc; if (openSrc == OpenSrc.Rank) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(RankingSystem.s_rankingForm); if (form == null) { Debug.LogError("can't get ranking form"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } RectTransform transform3 = form.transform.Find("bg") as RectTransform; if (transform3 == null) { Debug.LogError("ranking form's bg is null"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } widget.CustomSetActive(true); Vector3[] fourCornersArray = new Vector3[4]; transform3.GetWorldCorners(fourCornersArray); Vector2 vector3 = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, fourCornersArray[2]); Vector2 screenPoint = new Vector2(0f, vector3.y - 100f); if (((vector3.x + 80f) + transform.rect.width) > Screen.width) { screenPoint.x = (Screen.width - transform.rect.width) - 15f; } else { screenPoint.x = vector3.x + 80f; } transform.position = CUIUtility.ScreenToWorldPoint(script.GetCamera(), screenPoint, transform.position.z); } else if (openSrc == OpenSrc.Chat) { CUIFormScript script2 = Singleton <CUIManager> .GetInstance().GetForm(CChatController.ChatFormPath); if (script2 == null) { Debug.LogError("can't get chat form"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } RectTransform transform2 = script2.transform.Find("node/null") as RectTransform; if (transform2 == null) { Debug.LogError("chat form's close btn is null"); Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.Mini_Player_Info_CloseForm); return; } widget.CustomSetActive(true); Vector3[] vectorArray = new Vector3[4]; transform2.GetWorldCorners(vectorArray); Vector2 vector = CUIUtility.WorldToScreenPoint(Singleton <CUIManager> .instance.FormCamera, vectorArray[3]); Vector2 vector2 = new Vector2(0f, vector.y); if (((vector.x + transform.rect.width) + 100f) > Screen.width) { vector2.x = (Screen.width - transform.rect.width) - 15f; } else { vector2 = new Vector2(vector.x + 20f, vector.y); } transform.position = CUIUtility.ScreenToWorldPoint(script.GetCamera(), vector2, transform.position.z); } Text componetInChild = Utility.GetComponetInChild <Text>(script.gameObject, "panel/Name/Text"); if (componetInChild != null) { componetInChild.text = this.m_PlayerProfile.Name(); } COMDT_FRIEND_INFO comdt_friend_info = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.GameFriend, this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld); COMDT_FRIEND_INFO comdt_friend_info2 = Singleton <CFriendContoller> .instance.model.GetInfo(CFriendModel.FriendType.SNS, this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld); Text text2 = Utility.GetComponetInChild <Text>(script.gameObject, "panel/Online/Text"); if (text2 != null) { if (this.m_PlayerProfile.IsOnLine()) { if (((comdt_friend_info != null) ? comdt_friend_info : ((comdt_friend_info2 != null) ? comdt_friend_info2 : null)) != null) { COM_ACNT_GAME_STATE friendInGamingState = Singleton <CFriendContoller> .instance.model.GetFriendInGamingState(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld); switch (friendInGamingState) { case COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_IDLE: text2.text = string.Format("<color=#00ff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Online")); goto Label_0558; case COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_SINGLEGAME: case COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_MULTIGAME: text2.text = string.Format("<color=#ffff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Gaming")); goto Label_0558; } if (friendInGamingState == COM_ACNT_GAME_STATE.COM_ACNT_GAME_STATE_TEAM) { text2.text = string.Format("<color=#ffff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Teaming")); } } else { text2.text = string.Format("<color=#00ff00>{0}</color>", Singleton <CTextManager> .instance.GetText("Common_Online")); } } else { string text = Singleton <CTextManager> .GetInstance().GetText("Common_Offline"); text2.text = text; text2.text = text; } } Label_0558: text3 = Utility.GetComponetInChild <Text>(script.gameObject, "panel/DuanWei/Text"); if (text3 != null) { string rankTitle = CLadderView.GetRankTitle(this.m_PlayerProfile.GetRankGrade(), this.m_PlayerProfile.GetRankClass()); text3.text = !string.IsNullOrEmpty(rankTitle) ? rankTitle : Singleton <CTextManager> .GetInstance().GetText("Common_NoData"); } Text text4 = Utility.GetComponetInChild <Text>(script.gameObject, "panel/Team/Text"); Text text5 = Utility.GetComponetInChild <Text>(script.gameObject, "panel/Position/Text"); if (!CGuildSystem.IsInNormalGuild(this.m_PlayerProfile.GuildState) || string.IsNullOrEmpty(this.m_PlayerProfile.GuildName)) { if (text4 != null) { text4.text = Singleton <CTextManager> .GetInstance().GetText("PlayerInfo_Guild"); } if (text5 != null) { text5.text = Singleton <CTextManager> .GetInstance().GetText("PlayerInfo_Guild"); } } else { if (text4 != null) { text4.text = this.m_PlayerProfile.GuildName; } if (text5 != null) { text5.text = CGuildHelper.GetPositionName(this.m_PlayerProfile.GuildState); } } GameObject obj3 = Utility.FindChild(script.gameObject, "panel/Btn/AddFriend"); GameObject obj4 = Utility.FindChild(script.gameObject, "panel/Btn/Profile"); GameObject obj5 = Utility.FindChild(script.gameObject, "panel/Btn/3v3"); GameObject obj6 = Utility.FindChild(script.gameObject, "panel/Btn/5v5"); GameObject obj7 = Utility.FindChild(script.gameObject, "panel/Btn/Block"); obj4.CustomSetActive(true); switch (this.m_OpenSrc) { case OpenSrc.Rank: if ((comdt_friend_info != null) || (comdt_friend_info2 != null)) { obj3.CustomSetActive(false); obj5.CustomSetActive(true); obj6.CustomSetActive(true); } else { obj3.CustomSetActive(true); obj5.CustomSetActive(false); obj6.CustomSetActive(false); } obj7.CustomSetActive(false); break; case OpenSrc.Chat: switch (Singleton <CChatController> .GetInstance().view.CurTab) { case EChatChannel.Lobby: obj5.CustomSetActive(false); obj6.CustomSetActive(false); if ((comdt_friend_info == null) && (comdt_friend_info2 == null)) { obj3.CustomSetActive(true); } else { obj3.CustomSetActive(false); } obj7.CustomSetActive(true); this.SetBlockButtonBlocked(obj7, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); return; case EChatChannel.Friend: case EChatChannel.Select_Hero: case EChatChannel.Speaker: return; case EChatChannel.Guild: if ((comdt_friend_info == null) && (comdt_friend_info2 == null)) { obj3.CustomSetActive(true); obj5.CustomSetActive(false); obj6.CustomSetActive(false); } else { obj3.CustomSetActive(false); obj5.CustomSetActive(true); obj6.CustomSetActive(true); } obj7.CustomSetActive(true); this.SetBlockButtonBlocked(obj7, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); return; case EChatChannel.Friend_Chat: obj3.CustomSetActive(false); obj5.CustomSetActive(true); obj6.CustomSetActive(true); obj7.CustomSetActive(true); this.SetBlockButtonBlocked(obj7, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); return; case EChatChannel.Settle: obj3.CustomSetActive(false); obj5.CustomSetActive(false); obj6.CustomSetActive(false); obj7.CustomSetActive(true); this.SetBlockButtonBlocked(obj7, Singleton <CFriendContoller> .instance.model.IsBlack(this.m_CurSelectedUuid, (uint)this.m_CurSelectedLogicWorld)); return; } break; } }
public void AddHighlightForActor(PoolObjHandle <ActorRoot> actor, bool bPauseGame) { if (actor != 0) { ActorRoot handle = actor.handle; if (handle.InCamera) { GameObject content = Singleton <CResourceManager> .GetInstance().GetResource("UGUI/Form/System/Dialog/WeakGuideHighlighter.prefab", typeof(GameObject), enResourceType.UIPrefab, false, false).m_content as GameObject; if (content != null) { GameObject widget = UnityEngine.Object.Instantiate(content) as GameObject; if (widget != null) { if (NewbieGuideScriptControl.FormGuideMask == null) { NewbieGuideScriptControl.OpenGuideForm(); } CUIFormScript formGuideMask = NewbieGuideScriptControl.FormGuideMask; Transform transform = formGuideMask.transform; Vector3 screenPoint = (Vector3)CUIUtility.WorldToScreenPoint(Camera.main, (Vector3)handle.location); Vector3 worldPosition = CUIUtility.ScreenToWorldPoint(formGuideMask.GetCamera(), screenPoint, transform.position.z); Transform transform2 = widget.transform; transform2.SetSiblingIndex(1); transform2.SetParent(NewbieGuideScriptControl.FormGuideMask.transform); formGuideMask.InitializeWidgetPosition(widget, worldPosition); transform2.position = worldPosition; transform2.localScale = Vector3.one; CUIEventScript local1 = widget.AddComponent <CUIEventScript>(); local1.onClick = (CUIEventScript.OnUIEventHandler)Delegate.Combine(local1.onClick, new CUIEventScript.OnUIEventHandler(this.HighliterForActorClickHandler)); Singleton <CBattleGuideManager> .GetInstance().PauseGame(widget, false); } } } } }
public void Update(CUIFormScript formScript, float deltaTime) { if (this.m_duringTime < this.m_maxDuringTime) { this.m_duringTime += deltaTime; if (((this.m_signalInfo != null) && (this.m_signalInfo.bSignalType == 1)) && (this.m_signalRelatedActor != 0)) { Vector3 location = (Vector3)this.m_signalRelatedActor.handle.location; if (this.m_signalInUISequence >= 0) { GameObject element = this.m_signalInUIContainer.GetElement(this.m_signalInUISequence); if (element != null) { RectTransform transform = element.transform as RectTransform; CBattleSystem instance = Singleton <CBattleSystem> .GetInstance(); if (this.bSmall) { transform.anchoredPosition = new Vector2(location.x * instance.world_UI_Factor_Small.x, location.z * instance.world_UI_Factor_Small.y); } else { transform.anchoredPosition = new Vector2(location.x * instance.world_UI_Factor_Big.x, location.z * instance.world_UI_Factor_Big.y); } if ((this.m_signalInUIEffect != null) && (this.m_signalInUIEffect.parObj != null)) { Vector2 screenPosition = CUIUtility.WorldToScreenPoint(formScript.GetCamera(), element.transform.position); Singleton <CUIParticleSystem> .GetInstance().SetParticleScreenPosition(this.m_signalInUIEffect, ref screenPosition); } } } } } }
public void Initialize(CUIFormScript formScript, ResSignalInfo signalInfo) { if (this.m_playerID > 0) { Player player = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(this.m_playerID); if (player != null) { this.m_signalRelatedActor = player.Captain; } } this.m_signalInfo = signalInfo; if ((this.m_signalInfo == null) || (formScript == null)) { this.m_duringTime = 0f; this.m_maxDuringTime = 0f; } else { this.m_duringTime = 0f; this.m_maxDuringTime = this.m_signalInfo.bTime; if ((this.m_signalInfo.bSignalType == 0) && !string.IsNullOrEmpty(this.m_signalInfo.szSceneEffect)) { this.m_effectInScene = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.m_signalInfo.szSceneEffect, true, SceneObjType.Temp, this.m_worldPosition); this.m_effectInScene.CustomSetActive(true); } if ((this.m_signalInUIContainer != null) && !string.IsNullOrEmpty(this.m_signalInfo.szUIIcon)) { this.m_signalInUISequence = this.m_signalInUIContainer.GetElement(); GameObject element = this.m_signalInUIContainer.GetElement(this.m_signalInUISequence); if (element != null) { Image component = element.GetComponent <Image>(); if (component != null) { component.SetSprite(this.m_signalInfo.szUIIcon, formScript, true, false, false); component.color = new Color(1f, 1f, 1f, (this.m_signalInfo.bSignalType != 1) ? ((float)1) : ((float)0)); } Vector3 worldPosition = this.m_worldPosition; if ((this.m_signalInfo.bSignalType == 1) && (this.m_signalRelatedActor != 0)) { worldPosition = (Vector3)this.m_signalRelatedActor.handle.location; } if (this.bSmall) { (element.transform as RectTransform).anchoredPosition = new Vector2(worldPosition.x * Singleton <CBattleSystem> .GetInstance().world_UI_Factor_Small.x, worldPosition.z * Singleton <CBattleSystem> .GetInstance().world_UI_Factor_Small.y); } else { (element.transform as RectTransform).anchoredPosition = new Vector2(worldPosition.x * Singleton <CBattleSystem> .GetInstance().world_UI_Factor_Big.x, worldPosition.z * Singleton <CBattleSystem> .GetInstance().world_UI_Factor_Big.y); } if ((!string.IsNullOrEmpty(this.m_signalInfo.szRealEffect) && (this.m_signalInUISequence >= 0)) && (Singleton <CBattleSystem> .instance.TheMinimapSys.CurMapType() == MinimapSys.EMapType.Mini)) { Vector2 sreenLoc = CUIUtility.WorldToScreenPoint(formScript.GetCamera(), element.transform.position); this.m_signalInUIEffect = Singleton <CUIParticleSystem> .instance.AddParticle(this.m_signalInfo.szRealEffect, (float)this.m_signalInfo.bTime, sreenLoc); } } } if (this.bUseCfgSound) { string str = StringHelper.UTF8BytesToString(ref this.m_signalInfo.szSound); if (!string.IsNullOrEmpty(str)) { Singleton <CSoundManager> .GetInstance().PlayBattleSound2D(str); } } } }
private void AddHighlightInternal(GameObject baseGo, CUIFormScript inOriginalForm, bool cloneEvent, params GameObject[] addGo) { this.PreHighlight(); if (baseGo != null) { ms_originalGo.Add(baseGo); } if (addGo != null) { ms_originalGo.AddRange(addGo); } ms_originalForm = inOriginalForm; this.OpenGuideForm(); if (NewbieGuideScriptControl.FormGuideMask == null) { NewbieGuideScriptControl.OpenGuideForm(); } List <GameObject> .Enumerator enumerator = ms_originalGo.GetEnumerator(); int num = 0; while (enumerator.MoveNext()) { GameObject current = enumerator.Current; if (current != null) { GameObject widget = UnityEngine.Object.Instantiate(current) as GameObject; if (widget != null) { RectTransform transform = widget.transform as RectTransform; transform.SetParent(NewbieGuideScriptControl.FormGuideMask.transform); transform.SetSiblingIndex(1); transform.localScale = current.transform.localScale; RectTransform transform2 = current.transform as RectTransform; transform.pivot = transform2.pivot; transform.sizeDelta = transform2.sizeDelta; LayoutElement component = current.GetComponent <LayoutElement>(); if ((component != null) && (transform.sizeDelta == Vector2.zero)) { transform.sizeDelta = new Vector2(component.preferredWidth, component.preferredHeight); } transform.position = current.transform.position; Vector2 screenPoint = CUIUtility.WorldToScreenPoint(inOriginalForm.GetCamera(), current.transform.position); Vector3 worldPosition = CUIUtility.ScreenToWorldPoint(NewbieGuideScriptControl.FormGuideMask.GetCamera(), screenPoint, transform.position.z); NewbieGuideScriptControl.FormGuideMask.InitializeWidgetPosition(widget, worldPosition); widget.CustomSetActive(false); if (cloneEvent) { CUIEventScript script = current.GetComponent <CUIEventScript>(); CUIEventScript script2 = widget.GetComponent <CUIEventScript>(); if ((script != null) && (script2 != null)) { script2.m_onDownEventParams = script.m_onDownEventParams; script2.m_onUpEventParams = script.m_onUpEventParams; script2.m_onClickEventParams = script.m_onClickEventParams; script2.m_onHoldStartEventParams = script.m_onHoldStartEventParams; script2.m_onHoldEventParams = script.m_onHoldEventParams; script2.m_onHoldEndEventParams = script.m_onHoldEndEventParams; script2.m_onDragStartEventParams = script.m_onDragStartEventParams; script2.m_onDragEventParams = script.m_onDragEventParams; script2.m_onDragEndEventParams = script.m_onDragEndEventParams; script2.m_onDropEventParams = script.m_onDropEventParams; script2.m_closeFormWhenClicked = script.m_closeFormWhenClicked; script2.m_belongedFormScript = script.m_belongedFormScript; script2.m_belongedListScript = script.m_belongedListScript; script2.m_indexInlist = script.m_indexInlist; } CUIMiniEventScript script3 = current.GetComponent <CUIMiniEventScript>(); CUIMiniEventScript script4 = widget.GetComponent <CUIMiniEventScript>(); if ((script3 != null) && (script4 != null)) { script4.m_onDownEventParams = script3.m_onDownEventParams; script4.m_onUpEventParams = script3.m_onUpEventParams; script4.m_onClickEventParams = script3.m_onClickEventParams; script4.m_closeFormWhenClicked = script3.m_closeFormWhenClicked; script4.m_belongedFormScript = script3.m_belongedFormScript; script4.m_belongedListScript = script3.m_belongedListScript; script4.m_indexInlist = script3.m_indexInlist; } } else { CUIEventScript script5 = widget.GetComponent <CUIEventScript>(); if (script5 != null) { script5.enabled = false; } CUIMiniEventScript script6 = widget.GetComponent <CUIMiniEventScript>(); if (script6 != null) { script6.enabled = false; } } widget.CustomSetActive(true); CUIAnimatorScript script7 = current.GetComponent <CUIAnimatorScript>(); if (script7 != null) { CUICommonSystem.PlayAnimator(widget, script7.m_currentAnimatorStateName); } ms_highlitGo.Add(widget); GameObject content = Singleton <CResourceManager> .GetInstance().GetResource("UGUI/Form/System/Dialog/WeakGuideHighlighter.prefab", typeof(GameObject), enResourceType.UIPrefab, false, false).m_content as GameObject; if (content != null) { GameObject item = UnityEngine.Object.Instantiate(content) as GameObject; if (item != null) { item.transform.SetParent(widget.transform); Transform transform3 = item.transform; switch (this.currentConf.wFlipType) { case 0: transform3.localScale = s_FlipNone; break; case 1: transform3.localScale = s_FlipX; break; case 2: transform3.localScale = s_FlipY; break; case 3: transform3.localScale = s_FlipXY; break; } item.transform.position = widget.transform.position; (item.transform as RectTransform).anchoredPosition = new Vector2((float)this.currentConf.iOffsetHighLightX, (float)this.currentConf.iOffsetHighLightY); if (!this.DoesShowArrow()) { item.transform.FindChild("Panel/ImageFinger").gameObject.CustomSetActive(false); } ms_highlighter.Add(item); } } if ((num == 0) && (this.currentConf.wSpecialTip != 0)) { NewbieGuideSpecialTipConf specialTipConfig = Singleton <NewbieGuideDataManager> .GetInstance().GetSpecialTipConfig(this.currentConf.wSpecialTip); if ((specialTipConfig != null) && (specialTipConfig.bGuideTextPos > 0)) { GameObject obj6 = InstantiateGuideText(specialTipConfig, widget, NewbieGuideScriptControl.FormGuideMask, inOriginalForm); if (obj6 != null) { ms_guideTextList.Add(obj6); obj6.CustomSetActive(false); } } } num++; } } } }