private void InitDrawings() { MovingRange = UnitGO.transform.FindChild("MovingRange").gameObject; MovingArrow = UnitGO.transform.FindChild("MovingArrow").gameObject; SelectSign = GameObject.Instantiate(MovingRange) as GameObject; SelectSign.transform.parent = MovingRange.transform.parent; SelectSign.transform.localPosition = Vector3.zero; SelectSign.transform.localEulerAngles = Vector3.zero; SelectSign.transform.localScale = Vector3.one; SelectSign.SetActive(false); m_starRadiusDrawLine = SelectSign.AddComponent <TrollDrawCircle>();//星球大小 m_starRadiusDrawLine.SetRadius(BaseData.radius); MovingRange.SetActive(false); m_movingRangeDrawLine = MovingRange.AddComponent <TrollDrawCircle>();//移动半径 m_movingRangeDrawLine.SetRadius(BaseData.radius + BaseData.range); m_movingDrawArrow = MovingArrow.AddComponent <TrollDrawArrow>();//移动箭头 m_movingDrawArrow.SetSourcePos(MovingArrow.transform.position); m_movingDrawArrow.SetSourceRadius(BaseData.radius); var opt = OptDragListener.Get(UIBtn.gameObject); opt.onDrag = UpdateArrow; opt.onPress = SetArrowVisible; var cam = UIManager.I.GetUILogic <MapUIMgr>().MyCameraController; cam.onDrag += OnCameraDrag; cam.onScale += OnCameraScaleChanged; }
protected override void OnResourceLoaded() { var parent = MogoWorld.m_dataMapManager.GetUnitStarById(MogoWorld.thePlayer.HeadQuarterId).UnitParent.parent; SyncCreateUIInstanceWithRootTransform(Resources[0], parent); ComfirmBtn = FindTransform("EufloriaBtnOK").GetComponent <MogoUIBtn>(); CancelBtn = FindTransform("EufloriaBtnCancel").GetComponent <MogoUIBtn>(); ReconSoldierBtn = FindTransform("ReconSoldierBtn").GetComponent <MogoUIBtn>(); DeleteBtn = FindTransform("EufloriaBtnDelete").GetComponent <MogoUIBtn>(); PercentBtn = FindTransform("PercentBtn").GetComponent <MogoUIBtn>(); ComfirmBtn.ClickAction = OnComfirmBtnClickHandler; CancelBtn.ClickAction = OnCancelBtnClickHandler; ReconSoldierBtn.ClickAction = OnReconSoldierBtnClickHandler; DeleteBtn.ClickAction = OnDeleteBtnClickHandler; ComfirmBtn.gameObject.SetActive(false); CancelBtn.gameObject.SetActive(false); ReconSoldierBtn.gameObject.SetActive(false); DeleteBtn.gameObject.SetActive(false); ComfirmBtn.SetText(LanguageData.GetContent(186)); CancelBtn.SetText(LanguageData.GetContent(187)); DeleteBtn.SetText(LanguageData.GetContent(188)); var opt = OptDragListener.Get(PercentBtn.gameObject); opt.onDrag = UpdateArrow; ReconSoldierBtn.SetText(LanguageData.GetContent(182)); ShowPercent(true); AddListeners(); }
private int[] LimitPos = new int[] { -70, 50, 260, -250 };//左右上下 private void Start() { var lis = OptDragListener.Get(gameObject); lis.onDrag = OnThisDrag; }