public override void Init(BattleUnit unit) { base.Init(unit); _joystick = MainUI.Instance.GetPanel <BattlePanel>().Joystick; _unitArrow = unit.GetRoleArrow(); _followCamera = GameObject.FindObjectOfType <FollowCamera>(); }
void Start() { GameObject canvas = GameObject.Instantiate(Resources.Load <GameObject>("Canvas")); if (canvas == null || !showCanvas) { return; } gridTran = canvas.GetComponentInChildren <GridLayoutGroup>().transform; scrollCircle = canvas.GetComponentInChildren <ScrollCircle>(); GameObject buttonProto = Resources.Load <GameObject>("Button"); PoiInfo poiInfo = PoiParseTool.GetPoiObject(); if (poiInfo != null && poiInfo.poiList != null) { foreach (var tempPoi in poiInfo.poiList) { string strLog = $"poiid = {tempPoi.poiId}, posx ={tempPoi.posX}, posy = {tempPoi.posY}, posz = {tempPoi.posZ}"; GameObject button = GameObject.Instantiate(buttonProto); button.GetComponentInChildren <Text>().text = tempPoi.poiId; button.transform.SetParent(gridTran); button.GetComponent <Button>().onClick.AddListener(() => { this.transform.position = new Vector3(tempPoi.posX, tempPoi.posY, tempPoi.posZ); this.transform.localRotation = Quaternion.identity; Debug.Log("onclick" + this.transform.position); }); } } if (scrollCircle != null) { scrollCircle._rotationAction += changeCameraAngle; scrollCircle._dragStateAction += dragState; } }
static int OnEndDrag(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); ScrollCircle obj = (ScrollCircle)ToLua.CheckObject <ScrollCircle>(L, 1); UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L, 2); obj.OnEndDrag(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void Start() { ScrollCircle other = this.GetComponent <ScrollCircle>(); touchRadius = other.radius; //*2 scrollCircle = transform.GetComponent <ScrollCircle> (); Vector2 posstickGo = Vector2.zero;//TransformToCanvasLocalPosition (stickGo.transform, canvas); RectTransform canvasRectTransform = canvas.GetComponent <RectTransform> (); float scale = canvas.pixelRect.width / canvasRectTransform.rect.width; initPosition [0] = (canvasRectTransform.rect.width * 0.5f + posstickGo.x) * scale; initPosition [1] = (canvasRectTransform.rect.width * 0.5f + posstickGo.x) * scale; }
static int get_mRadius(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollCircle obj = (ScrollCircle)o; float ret = obj.mRadius; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mRadius on a nil value")); } }
static int set_mRadius(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScrollCircle obj = (ScrollCircle)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.mRadius = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mRadius on a nil value")); } }
private Vector3 rotNegative; //x反向 virtual protected void Start() { herorigidbody = gameObject.GetComponent <Rigidbody2D>(); heroAnime = gameObject.GetComponent <HeroAnime>(); heroSkill = gameObject.GetComponent <HeroSkill>(); rotPositive = new Vector3(0, 0, 0); rotNegative = new Vector3(0, 180, 0); gameObject.GetComponent <Character>().xDirection = true; joystick = GameObject.Find("UIPlay/JoystickBack").GetComponent <ScrollCircle>(); //初始化相机位置 Vector3 cameraPos = Camera.main.transform.position; cameraPos.x = gameObject.transform.position.x + 3.5f; Camera.main.transform.position = cameraPos; }
private void Awake() { //设置POEStatics if (POEStatics.Player == null) { POEStatics.Player = gameObject; } if (POEStatics.PlayerController == null) { POEStatics.PlayerController = this; } if (POEStatics.PlayerMeshRenderer == null) { POEStatics.PlayerMeshRenderer = POEStatics.Player.GetComponent <MeshRenderer>(); } //获取组件 m_rgbd = gameObject.GetComponent <Rigidbody>(); m_HPControllerPlayer = gameObject.GetComponent <HPControllerPlayer>(); S = gameObject.GetComponent <POEStatus>(); m_JoyStick = GameObject.Find("JoystickBackGround").GetComponent <ScrollCircle>(); }
public void OnOpen(object data) { var dic = ViewTools.CollectAllGameObjects(m_gameObject); m_scroll = dic["HpScroll"].GetComponent <UIHPScroll>(); if (m_scroll != null) { m_scroll.OnOpen(data); } m_hitMask = dic["HitMask"].GetComponent <UIHitMask>(); if (m_hitMask != null) { m_hitMask.OnOpen(data); } m_joy = dic["MoveJoy"].GetComponentInChildren <ScrollCircle>(); if (m_joy != null) { ScrollCircle.On_JoyTouchStart += OnMoveStart; ScrollCircle.On_JoyTouching += OnMoving; ScrollCircle.On_JoyTouchEnd += OnMoveEnd; } }
private void Awake() { touch = GameObject.FindGameObjectWithTag("touch").GetComponent <ScrollCircle>(); }