Пример #1
0
 private void CheckIdleWeapon()
 {
     if (!m_DirtyRocketGun && ETCJoystick.GetTouchCount() == 0 && !Input.anyKey)
     {
         m_DirtyRocketGun      = true;
         m_ChangingFirstWeapon = false;
         m_FirstGunDuration    = 0;
         Global.gApp.gMsgDispatcher.Broadcast <string, string, float>(MsgIds.AddFightUICountItem, "Weapon", GameConstVal.WRPG, -1);
         ChangeWeapon(GameConstVal.WRPG, 99999999);
     }
     else if (m_DirtyRocketGun && (ETCJoystick.GetTouchCount() > 0 || Input.anyKey))
     {
         m_DirtyRocketGun      = false;
         m_ChangingFirstWeapon = false;
         m_FirstGunDuration    = 0;
         ResetFirstWeapon();
     }
 }
Пример #2
0
    void Awake()
    {
        Initialize();


        GameObject touchControl = GameObject.Find("EasyTouchControlsCanvas");

        leftJoystick = touchControl.transform.Find("LeftJoyStick").GetComponent <ETCJoystick>();
        skillButton  = touchControl.transform.Find("SkillButton").GetComponent <ETCButton>();

        leftJoystick.cameraLookAt = null;
        //Camera camera = Camera.main.GetComponent<Camera>();
        //camera.follow = transform;

        leftJoystick.onMove.AddListener(OnMove);
        leftJoystick.onMoveEnd.AddListener(OnMoveEnd);

        skillButton.onUp.AddListener(OnSkill);
    }
Пример #3
0
    public void InitMyPlayer()
    {
        GameObject myPlayerGO = RoleMgr.singleton.GetPlayer(0);

        if (myPlayerGO)
        {
            mMyPlayer     = myPlayerGO.GetComponent <Player>();
            mMyPlayerData = mMyPlayer.mRoleData as PlayerData;
        }

        if (controlETCJoystick == null)
        {
            controlETCJoystick = ETCInput.GetControlJoystick("Joystick");
            if (controlETCJoystick && controlETCJoystick.cameraLookAt == null)
            {
                controlETCJoystick.cameraLookAt = mMyPlayer.transform;
            }
        }
    }
        /// <summary>
        /// 初始化第一次赋值
        /// </summary>

        private void Start()
        {
            playerStatus = GetComponent <PlayerStatus>();
            //chSkillMsg = GetComponent<CharacterSkillManager>();
            chMotor    = GetComponent <CharacterMontor>();
            joyStick   = ETCInput.GetControlJoystick("MyJoystick");
            skill01    = ETCInput.GetControlButton("Skill1");
            skill02    = ETCInput.GetControlButton("Skill2");
            baseAttack = ETCInput.GetControlButton("BaseAttack");


            //joyStick.onMove.AddListener(JoystickMove);
            //绑定事件
            joyStick.onMove.AddListener(JoystickMove);
            joyStick.onMoveEnd.AddListener(JoystickMoveEnd);

            baseAttack.onDown.AddListener(() => ButtonDown(10));
            skill01.onDown.AddListener(() => ButtonDown(11));
            skill02.onDown.AddListener(() => ButtonDown(12));
        }
Пример #5
0
    public static void SetJoystickThumbSprite(string ctrlName, Sprite spr, Color color = default(Color))
    {
        if (ETCInput.instance.controls.TryGetValue(ctrlName, out control))
        {
            if (control.GetType() == typeof(ETCJoystick))
            {
                ETCJoystick tmpJoy = (ETCJoystick)control;
                if (tmpJoy)
                {
                    Image img = tmpJoy.thumb.GetComponent <Image>();

                    if (img)
                    {
                        img.sprite = spr;
                        img.color  = color;
                    }
                }
            }
        }
    }
Пример #6
0
        private void Start()
        {
            m_horizontalJoystick = this.transform.Find(HORIZONTAL_JOYSTICK).GetComponent <ETCJoystick>();
            m_verticalJoystick   = this.transform.Find(VERTICAL_JOYSTICK).GetComponent <ETCJoystick>();

            /*
             * m_horizontalJoystick = this.GetComponentInChildren<ETCJoystick>();
             * m_speedUpBtn = this.GetComponentInChildren<ETCButton>();
             *
             * if (m_horizontalJoystick == null || m_speedUpBtn == null)
             * {
             *  this.LogError("Start() m_joystick == null || m_speedUpBtn == null");
             * }
             */
            if (m_horizontalJoystick == null || m_verticalJoystick == null)
            {
                this.LogError("Start() HorizontalJoystick == null || VerticalJoystick == null");
                return;
            }

            RegisterListeners();
        }
Пример #7
0
 void Start()
 {
     this.characterController = this.GetComponent <CharacterController>();
     this.cameraTransform     = this.GetComponentInChildren <Camera>().transform;
     this.moveJoystick        = ETCInput.GetControlJoystick("MoveJoystick");
     this.jumpButton.onDown.AddListener(() =>
     {
         if (!this.jumpLocked && this.timeInAir < 0.5f)
         {
             this.timeInAir     = 0.5f;
             this.verticalSpeed = this.JumpStrength;
             this.jumpLocked    = true;
         }
     });
     this.jumpButton.onUp.AddListener(() => this.jumpLocked        = false);
     this.jetButton.onPressed.AddListener(() => this.verticalSpeed = 2f);
     Cursor.visible   = true;
     Cursor.lockState = CursorLockMode.Confined;
     //陀螺仪的设置
     Input.gyro.enabled        = true;
     Input.compensateSensors   = true;
     Input.gyro.updateInterval = 0.01f;
 }
Пример #8
0
        protected void OnInit(object userData)
        {
            isGameSuccess     = false;
            m_ArrowPlayerData = userData as ArrowPlayerData;

            m_EtcJoystick = FindObjectOfType <ETCJoystick>();

            if (!m_CharacterController)
            {
                m_CharacterController = GetComponentInChildren <CharacterController>();
            }

            m_JoyNameType = JoyNameType.MoveJoy;

            m_EtcJoystick.onMoveStart.AddListener(MoveStartEvent);
            m_EtcJoystick.onMove.AddListener(MoveEvent);
            m_EtcJoystick.onMoveEnd.AddListener(MoveEndEvent);

            m_SpineItem = GetComponentInChildren <SpineItem>();
            m_Weapon    = gameObject.AddComponent <Weapon>();
            //生成Hp
            UIHpBarManager.m_UIHpBarManager.ShowHPBar(this, m_ArrowPlayerData.HP, m_ArrowPlayerData.HPRatio);
        }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        joystick     = GameObject.Find("MoveJoystick");
        joystickBind = joystick.GetComponent <JoystickBind>();
        if (!joystickBind.getBinded())
        {
            etcJoystick = joystick.GetComponent <ETCJoystick>();
            robotMotion = gameObject.GetComponent <RobotMotion>();
            etcJoystick.onMove.AddListener(robotMotion.JoystickMove);
            etcJoystick.onTouchStart.AddListener(robotMotion.JoystickMoveStart);
            etcJoystick.onTouchUp.AddListener(robotMotion.JoysitckMoveEnd);

            mainCamera         = GameObject.Find("Main Camera");
            cameraMotion       = mainCamera.GetComponent <CameraMotion>();
            cameraMotion.Robot = gameObject;

            minimapCamera       = GameObject.Find("MinimapCamera");
            minimapMotion       = minimapCamera.GetComponent <MinimapMotion>();
            minimapMotion.Robot = gameObject;

            joystickBind.bindJoystick();
        }
    }
Пример #10
0
 void Start()
 {
     aniSpeed           = 1;
     Spriteslider.mundo = this;
     ETCJoystick.anima  = GameObject.FindWithTag("Player").GetComponent <Mundo>();
     syncPlayerRequest  = GameObject.FindGameObjectWithTag("UI").GetComponent <SyncPlayerRequest>();
     easyTouch          = GameObject.FindWithTag("EasyTouch");
     syncPlayerRequest.DefaltRequest();
     spriteslider = GameObject.FindWithTag("UI").GetComponent <Spriteslider>();
     overRequest  = GameObject.FindWithTag("UI").GetComponent <GameOverRequest>();
     //将this Object 上面的Component赋值给定义的AudioSource
     source        = GetComponent <AudioSource>();
     source.volume = Setting.Sound;
     cc            = GetComponent <CharacterController>();
     ani           = GetComponent <Animator>();
     postion       = GetComponent <Transform>();
     stick         = GameObject.FindWithTag("Q Joystick").GetComponent <ETCJoystick>();
     mainStick     = GameObject.FindWithTag("Main Joystick").GetComponent <ETCJoystick>();
     m_image       = GameObject.FindWithTag("QMask").GetComponent <Image>();
     syncCharacter = GetComponent <SyncPlayDataRequest>();
     InvokeRepeating("SyncPlayData", 0, 0.01f);
     GameSetup();
 }
Пример #11
0
    private void InitOject()
    {
        index   = JsonPlayerData.Instance.GetDataIndex();
        control = JsonPlayerData.Instance.GetDataControl();

        etcJoystick = GameObject.Find("Joystick").GetComponent <ETCJoystick>();
        etcTouchPad = GameObject.Find("TouchPad").GetComponent <ETCTouchPad>();


        button_Attack = GameObject.Find("Attack").GetComponent <ETCButton>();
        button_Parse  = GameObject.Find("GamingParseButton").GetComponent <Button>();

        starText = GameObject.Find("StarNumText").GetComponent <Text>();

        button_Parse.onClick.AddListener(UIStateController.Instance.ParseState);

        button_Attack.onDown.AddListener(PlayerController.Instance.PlayerAttack);
        button_Attack.onUp.AddListener(PlayerController.Instance.PlayerAttackEnd);


        etcJoystick.onMoveSpeed.AddListener(PlayerController.Instance.PlayerMove);
        etcTouchPad.onMoveSpeed.AddListener(PlayerController.Instance.PlayerMove);

        if (control == "0")
        {
            etcJoystick.gameObject.SetActive(false);
        }
        else
        {
            etcTouchPad.gameObject.SetActive(false);
        }

        string path = "Player/ship_" + index;

        PlayerController.Instance.InitPlayer(path);
    }
Пример #12
0
 private void Init()
 {
     m_transform = this.transform as RectTransform;
     _joystick   = m_transform.GetComponent <ETCJoystick>();
 }
    public override void OnInspectorGUI()
    {
        ETCJoystick t = (ETCJoystick)target;


        EditorGUILayout.Space();

        t.gameObject.name = EditorGUILayout.TextField("Joystick name", t.gameObject.name);
        t.activated       = ETCGuiTools.Toggle("Activated", t.activated, true);
        t.visible         = ETCGuiTools.Toggle("Visible", t.visible, true);

        EditorGUILayout.Space();
        t.useFixedUpdate        = ETCGuiTools.Toggle("Use Fixed Updae", t.useFixedUpdate, true);
        t.isUnregisterAtDisable = ETCGuiTools.Toggle("Unregister at disabling time", t.isUnregisterAtDisable, true);

        EditorGUILayout.Space();

        #region Type & Size
        t.showPSInspector = ETCGuiTools.BeginFoldOut("Position & Size", t.showPSInspector);
        if (t.showPSInspector)
        {
            ETCGuiTools.BeginGroup(); {
                // Type
                t.joystickType = (ETCJoystick.JoystickType)EditorGUILayout.EnumPopup("Type", t.joystickType);

                if (t.joystickType == ETCJoystick.JoystickType.Static)
                {
                    t.anchor = (ETCBase.RectAnchor)EditorGUILayout.EnumPopup("Anchor", t.anchor);
                    if (t.anchor != ETCBase.RectAnchor.UserDefined)
                    {
                        t.anchorOffet = EditorGUILayout.Vector2Field("Offset", t.anchorOffet);
                    }

                    t.IsNoOffsetThumb = ETCGuiTools.Toggle("No offset thumb", t.IsNoOffsetThumb, true);

                    //	if (t.isNoOffsetThumb) t.isNoReturn = false;
                    t.IsNoReturnThumb = ETCGuiTools.Toggle("No return of the thumb", t.IsNoReturnThumb, true);
                }
                else if (t.joystickType == ETCJoystick.JoystickType.Dynamic)
                {
                    t.anchor = ETCBase.RectAnchor.UserDefined;
                    t.allowJoystickOverTouchPad = ETCGuiTools.Toggle("Allow over touchpad", t.allowJoystickOverTouchPad, true);
                    t.joystickArea = (ETCJoystick.JoystickArea)EditorGUILayout.EnumPopup("Joystick area", t.joystickArea);
                    if (t.joystickArea == ETCJoystick.JoystickArea.UserDefined)
                    {
                        t.userArea = (RectTransform)EditorGUILayout.ObjectField("User area", t.userArea, typeof(RectTransform), true);
                    }
                }

                EditorGUILayout.Space();

                // Area sprite ratio
                Rect  rect  = t.GetComponent <Image>().sprite.rect;
                float ratio = rect.width / rect.height;

                // Area Size
                if (ratio >= 1)
                {
                    float s = EditorGUILayout.FloatField("Background size", t.rectTransform().rect.width);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s / ratio);
                }
                else
                {
                    float s = EditorGUILayout.FloatField("Background size", t.rectTransform().rect.height);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s * ratio);
                }

                // Thumb sprite ratio
                rect  = t.thumb.GetComponent <Image>().sprite.rect;
                ratio = rect.width / rect.height;

                // Thumb size
                if (ratio >= 1)
                {
                    float s = EditorGUILayout.FloatField("Thumb size", t.thumb.rectTransform().rect.width);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s / ratio);
                }
                else
                {
                    float s = EditorGUILayout.FloatField("Thumb size", t.thumb.rectTransform().rect.height);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s * ratio);
                }

                EditorGUILayout.Space();

                t.radiusBase = (ETCJoystick.RadiusBase)EditorGUILayout.EnumPopup("Radius based on", t.radiusBase);

                EditorGUILayout.Space();
            } ETCGuiTools.EndGroup();
        }
        #endregion

        #region Axes properties
        t.showAxesInspector = ETCGuiTools.BeginFoldOut("Axes properties", t.showAxesInspector);
        if (t.showAxesInspector)
        {
            ETCGuiTools.BeginGroup(); {
                EditorGUILayout.Space();

                t.enableKeySimulation = ETCGuiTools.Toggle("Enable key simulation", t.enableKeySimulation, true);
                if (t.enableKeySimulation)
                {
                    t.allowSimulationStandalone = ETCGuiTools.Toggle("Allow simulation on standalone", t.allowSimulationStandalone, true);
                }
                EditorGUILayout.Space();

                ETCGuiTools.BeginGroup(5); {
                    ETCAxisInspector.AxisInspector(t.axisX, "Horizontal", ETCBase.ControlType.Joystick);
                } ETCGuiTools.EndGroup();

                ETCGuiTools.BeginGroup(5); {
                    ETCAxisInspector.AxisInspector(t.axisY, "Vertical", ETCBase.ControlType.Joystick);
                } ETCGuiTools.EndGroup();
            } ETCGuiTools.EndGroup();
        }
        #endregion

        #region sprites
        t.showSpriteInspector = ETCGuiTools.BeginFoldOut("Sprites", t.showSpriteInspector);
        if (t.showSpriteInspector)
        {
            ETCGuiTools.BeginGroup(); {
                #region Background
                Sprite areaSprite = t.GetComponent <Image>().sprite;

                EditorGUILayout.BeginHorizontal();
                t.GetComponent <Image>().sprite = (Sprite)EditorGUILayout.ObjectField("Background", t.GetComponent <Image>().sprite, typeof(Sprite), true, GUILayout.MinWidth(100));
                t.GetComponent <Image>().color  = EditorGUILayout.ColorField("", t.GetComponent <Image>().color, GUILayout.Width(50));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
                Rect spriteRect = new Rect(areaSprite.rect.x / areaSprite.texture.width,
                                           areaSprite.rect.y / areaSprite.texture.height,
                                           areaSprite.rect.width / areaSprite.texture.width,
                                           areaSprite.rect.height / areaSprite.texture.height);
                GUILayout.Space(8);
                Rect lastRect = GUILayoutUtility.GetLastRect();
                lastRect.x      = 20;
                lastRect.width  = 100;
                lastRect.height = 100;

                GUILayout.Space(100);

                ETCGuiTools.DrawTextureRectPreview(lastRect, spriteRect, t.GetComponent <Image>().sprite.texture, Color.white);
                #endregion
                EditorGUILayout.Space();
                #region thumb
                Sprite thumbSprite = t.thumb.GetComponent <Image>().sprite;

                EditorGUILayout.BeginHorizontal();
                t.thumb.GetComponent <Image>().sprite = (Sprite)EditorGUILayout.ObjectField("Thumb", t.thumb.GetComponent <Image>().sprite, typeof(Sprite), true, GUILayout.MinWidth(100));
                t.thumb.GetComponent <Image>().color  = EditorGUILayout.ColorField("", t.thumb.GetComponent <Image>().color, GUILayout.Width(50));
                EditorGUILayout.EndHorizontal();

                spriteRect = new Rect(thumbSprite.rect.x / thumbSprite.texture.width,
                                      thumbSprite.rect.y / thumbSprite.texture.height,
                                      thumbSprite.rect.width / thumbSprite.texture.width,
                                      thumbSprite.rect.height / thumbSprite.texture.height);

                GUILayout.Space(8);
                lastRect        = GUILayoutUtility.GetLastRect();
                lastRect.x      = 20;
                lastRect.width  = 100;
                lastRect.height = 100;

                GUILayout.Space(100);

                ETCGuiTools.DrawTextureRectPreview(lastRect, spriteRect, t.thumb.GetComponent <Image>().sprite.texture, Color.white);

                #endregion
            } ETCGuiTools.EndGroup();
        }
        #endregion

        #region Events
        t.showEventInspector = ETCGuiTools.BeginFoldOut("Move Events", t.showEventInspector);
        if (t.showEventInspector)
        {
            ETCGuiTools.BeginGroup(); {
                serializedObject.Update();
                SerializedProperty moveStartEvent = serializedObject.FindProperty("onMoveStart");
                EditorGUILayout.PropertyField(moveStartEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty moveEvent = serializedObject.FindProperty("onMove");
                EditorGUILayout.PropertyField(moveEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty moveSpeedEvent = serializedObject.FindProperty("onMoveSpeed");
                EditorGUILayout.PropertyField(moveSpeedEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty moveEndEvent = serializedObject.FindProperty("onMoveEnd");
                EditorGUILayout.PropertyField(moveEndEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            } ETCGuiTools.EndGroup();
        }

        t.showTouchEventInspector = ETCGuiTools.BeginFoldOut("Touch Events", t.showTouchEventInspector);
        if (t.showTouchEventInspector)
        {
            ETCGuiTools.BeginGroup(); {
                serializedObject.Update();
                SerializedProperty touchStartEvent = serializedObject.FindProperty("onTouchStart");
                EditorGUILayout.PropertyField(touchStartEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty touchUpEvent = serializedObject.FindProperty("onTouchUp");
                EditorGUILayout.PropertyField(touchUpEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            } ETCGuiTools.EndGroup();
        }

        t.showDownEventInspector = ETCGuiTools.BeginFoldOut("Down Events", t.showDownEventInspector);
        if (t.showDownEventInspector)
        {
            ETCGuiTools.BeginGroup(); {
                serializedObject.Update();
                SerializedProperty downUpEvent = serializedObject.FindProperty("OnDownUp");
                EditorGUILayout.PropertyField(downUpEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty downRightEvent = serializedObject.FindProperty("OnDownRight");
                EditorGUILayout.PropertyField(downRightEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty downDownEvent = serializedObject.FindProperty("OnDownDown");
                EditorGUILayout.PropertyField(downDownEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty downLeftEvent = serializedObject.FindProperty("OnDownLeft");
                EditorGUILayout.PropertyField(downLeftEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            } ETCGuiTools.EndGroup();
        }

        t.showPressEventInspector = ETCGuiTools.BeginFoldOut("Press Events", t.showPressEventInspector);
        if (t.showPressEventInspector)
        {
            ETCGuiTools.BeginGroup(); {
                serializedObject.Update();
                SerializedProperty pressUpEvent = serializedObject.FindProperty("OnPressUp");
                EditorGUILayout.PropertyField(pressUpEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty pressRightEvent = serializedObject.FindProperty("OnPressRight");
                EditorGUILayout.PropertyField(pressRightEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty pressDownEvent = serializedObject.FindProperty("OnPressDown");
                EditorGUILayout.PropertyField(pressDownEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty pressLeftEvent = serializedObject.FindProperty("OnPressLeft");
                EditorGUILayout.PropertyField(pressLeftEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            } ETCGuiTools.EndGroup();
        }

        #endregion

        if (GUI.changed)
        {
            EditorUtility.SetDirty(t);
        }

        if (t.anchor != ETCBase.RectAnchor.UserDefined && t.joystickType == ETCJoystick.JoystickType.Static)
        {
            t.SetAnchorPosition();
        }
    }
Пример #14
0
 void Awake()
 {
     m_Joystick = GetComponent <ETCJoystick>();
 }
    private void TurnAndMove(ETCAxis X, ETCAxis Y, ETCJoystick j)
    {
        EditorGUI.indentLevel++;
        X.autoLinkTagPlayer = EditorGUILayout.ToggleLeft("Auto link on tag",X.autoLinkTagPlayer, GUILayout.Width(200));
        if (X.autoLinkTagPlayer){
            X.autoTag = EditorGUILayout.TagField("",X.autoTag);
        }

        if (!X.autoLinkTagPlayer){
            X.directTransform = (Transform)EditorGUILayout.ObjectField("Direct action to",X.directTransform,typeof(Transform),true);
        }
        EditorGUILayout.Space();

        if (j.tmMoveCurve==null){
            j.InitTurnMoveCurve();
        }
        j.tmMoveCurve = EditorGUILayout.CurveField("Move curve",j.tmMoveCurve);

        j.tmSpeed = EditorGUILayout.FloatField("Move speed",j.tmSpeed);
        j.tmAdditionnalRotation = EditorGUILayout.FloatField("Intial rotation",j.tmAdditionnalRotation);

        j.tmLockInJump = EditorGUILayout.Toggle("Lock in jump",j.tmLockInJump);

        X.gravity = EditorGUILayout.FloatField("Gravity",X.gravity);
        EditorGUI.indentLevel--;
    }
Пример #16
0
    //==========================处理网络数据结束=============================================================
    //==========================处理摇杆等本地操作开始=======================================================
    void Start()
    {
        bloodStrip = transform.gameObject.AddComponent <BloodStrip>();
        bloodStrip.InitBloodStrip(mActorAttr);
        InitWillUsedPrefabs();
        Camera mCamera = transform.Find("camera").GetComponent <Camera>();

        if (this.IsETCControl == false)
        {
            mCamera.enabled = false;
            return;
        }
        mCamera.enabled = true;
        _FightCamera    = mCamera;
        splatManager    = ActorObj.AddComponent <SplatManager>();
        InitSkill();
        splatManager.AutoInit();
        joy_move    = GameObject.Find("Joystick_move").GetComponent <ETCJoystick>();
        joy_skill_1 = GameObject.Find("Joystick_skill_1").GetComponent <ETCJoystick>();
        button_1    = GameObject.Find("ETCButton_1").GetComponent <ETCButton>();
        joy_skill_2 = GameObject.Find("Joystick_skill_2").GetComponent <ETCJoystick>();
        button_2    = GameObject.Find("ETCButton_2").GetComponent <ETCButton>();
        joy_skill_3 = GameObject.Find("Joystick_skill_3").GetComponent <ETCJoystick>();
        button_3    = GameObject.Find("ETCButton_3").GetComponent <ETCButton>();
        //joy_skill_4 = GameObject.Find("Joystick_skill_4").GetComponent<ETCJoystick>();
        button_4     = GameObject.Find("ETCButton_4").GetComponent <ETCButton>();
        image_quxiao = GameObject.Find("Image_quxiao");
        image_quxiao.SetActive(false);
        image_quxiao2 = GameObject.Find("Image_quxiao2");
        image_quxiao2.SetActive(false);
        ScreenWidth      = Screen.width;
        ScreenHeigth     = Screen.height;
        ScreenScale      = Screen.width * 1000 / 1920;   //已宽度为准的缩放比例
        ScreenWidth_Min  = ScreenWidth - 325 * ScreenScale / 1000;
        ScreenWidth_Max  = ScreenWidth - 175 * ScreenScale / 1000;
        ScreenHeigth_Min = ScreenHeigth - 325 * ScreenScale / 1000;
        ScreenHeigth_Max = ScreenHeigth - 175 * ScreenScale / 1000;
        //Debug.LogErrorFormat("Screen==========>{0},{1},{2}", ScreenWidth, ScreenHeigth, ScreenScale);
        //Debug.LogErrorFormat("Scale===========>{0},{1},{2},{3}", ScreenWidth_Min, ScreenWidth_Max, ScreenHeigth_Min, ScreenHeigth_Max);
        if (joy_move != null)
        {
            joy_move.onMoveStart.AddListener(StartMoveCallBack);
            joy_move.onMove.AddListener(MoveCallBack);
            joy_move.onMoveEnd.AddListener(EndMoveCallBack);
        }
        if (button_1 != null)
        {
            switch (SkillControlType_1)
            {
            case SkillControlType.Button_KeyDown:
            case SkillControlType.Button_KeyUp:    //操作上都生效,网络不一定都发送
                joy_skill_1.activated = false;
                button_1.activated    = true;
                button_1.onUp.AddListener(onUp_Skill_1);
                button_1.onDown.AddListener(onDown_Skill_1);
                break;

            case SkillControlType.Joy_Angle:
                button_1.activated    = false;
                button_1.visible      = false;
                joy_skill_1.activated = true;
                joy_skill_1.onMoveStart.AddListener(StartMoveCallBack_Skill_1);
                joy_skill_1.onMove.AddListener(MoveCallBack_Skill_1);
                joy_skill_1.onMoveEnd.AddListener(EndMoveCallBack_Skill_1);
                break;

            case SkillControlType.Joy_XY:
                button_1.activated    = false;
                button_1.visible      = false;
                joy_skill_1.activated = true;
                joy_skill_1.activated = true;
                joy_skill_1.onMoveStart.AddListener(StartMoveCallBack_Skill_1);
                joy_skill_1.onMove.AddListener(MoveCallBack_Skill_1);
                joy_skill_1.onMoveEnd.AddListener(EndMoveCallBack_Skill_1);
                break;
            }
        }
        if (button_2 != null)
        {
            switch (SkillControlType_2)
            {
            case SkillControlType.Button_KeyDown:
            case SkillControlType.Button_KeyUp:
                joy_skill_2.activated = false;
                button_2.activated    = true;
                button_2.onUp.AddListener(onUp_Skill_2);
                button_2.onDown.AddListener(onDown_Skill_2);
                break;

            case SkillControlType.Joy_Angle:
                button_2.activated    = false;
                button_2.visible      = false;
                joy_skill_2.activated = true;
                joy_skill_2.onMoveStart.AddListener(StartMoveCallBack_Skill_2);
                joy_skill_2.onMove.AddListener(MoveCallBack_Skill_2);
                joy_skill_2.onMoveEnd.AddListener(EndMoveCallBack_Skill_2);
                break;

            case SkillControlType.Joy_XY:
                button_2.activated    = false;
                button_2.visible      = false;
                joy_skill_2.activated = true;
                joy_skill_2.onMoveStart.AddListener(StartMoveCallBack_Skill_2);
                joy_skill_2.onMove.AddListener(MoveCallBack_Skill_2);
                joy_skill_2.onMoveEnd.AddListener(EndMoveCallBack_Skill_2);
                break;
            }
        }
        if (button_3 != null)
        {
            switch (SkillControlType_3)
            {
            case SkillControlType.Button_KeyDown:
            case SkillControlType.Button_KeyUp:
                joy_skill_3.activated = false;
                button_3.activated    = true;
                button_3.onUp.AddListener(onUp_Skill_3);
                button_3.onDown.AddListener(onDown_Skill_3);
                break;

            case SkillControlType.Joy_Angle:
                button_3.activated    = false;
                button_3.visible      = false;
                joy_skill_3.activated = true;
                joy_skill_3.onMoveStart.AddListener(StartMoveCallBack_Skill_3);
                joy_skill_3.onMove.AddListener(MoveCallBack_Skill_3);
                joy_skill_3.onMoveEnd.AddListener(EndMoveCallBack_Skill_3);
                break;

            case SkillControlType.Joy_XY:
                button_3.activated    = false;
                button_3.visible      = false;
                joy_skill_3.activated = true;
                joy_skill_3.onMoveStart.AddListener(StartMoveCallBack_Skill_3);
                joy_skill_3.onMove.AddListener(MoveCallBack_Skill_3);
                joy_skill_3.onMoveEnd.AddListener(EndMoveCallBack_Skill_3);
                break;
            }
        }
        if (button_4 != null)
        {
            switch (SkillControlType_4)
            {
            case SkillControlType.Button_KeyDown:
            case SkillControlType.Button_KeyUp:
                //joy_skill_4.activated = false;
                button_4.activated = true;
                button_4.onUp.AddListener(onUp_Skill_4);
                button_4.onDown.AddListener(onDown_Skill_4);
                break;

            case SkillControlType.Joy_Angle:
                button_4.activated = false;
                //joy_skill_4.activated = true;
                //joy_skill_4.onMoveStart.AddListener(StartMoveCallBack_Skill_4);
                //joy_skill_4.onMove.AddListener(MoveCallBack_Skill_4);
                //joy_skill_4.onMoveEnd.AddListener(EndMoveCallBack_Skill_4);
                break;

            case SkillControlType.Joy_XY:
                button_4.activated = false;
                //joy_skill_4.activated = true;
                //joy_skill_4.onMoveStart.AddListener(StartMoveCallBack_Skill_4);
                //joy_skill_4.onMove.AddListener(MoveCallBack_Skill_4);
                //joy_skill_4.onMoveEnd.AddListener(EndMoveCallBack_Skill_4);
                break;
            }
        }
    }
	// Use this for initialization
	void Start () {

        JoyStick = gameObject.GetComponent<ETCJoystick>();
    }
Пример #18
0
 void Start()
 {
     mj = GameObject.Find("MyJoystick").GetComponent <ETCJoystick>();
 }
Пример #19
0
    public override void OnInspectorGUI()
    {
        ETCJoystick t = (ETCJoystick)target;


        EditorGUILayout.Space();

        t.gameObject.name = EditorGUILayout.TextField("Joystick name", t.gameObject.name);
        t.activated       = ETCGuiTools.Toggle("Activated", t.activated, true);
        t.visible         = ETCGuiTools.Toggle("Visible", t.visible, true);

        EditorGUILayout.Space();
        t.useFixedUpdate        = ETCGuiTools.Toggle("Use Fixed Updae", t.useFixedUpdate, true);
        t.isUnregisterAtDisable = ETCGuiTools.Toggle("Unregister at disabling time", t.isUnregisterAtDisable, true);

        EditorGUILayout.Space();

        #region Type & Size
        t.showPSInspector = ETCGuiTools.BeginFoldOut("Position & Size", t.showPSInspector);
        if (t.showPSInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                // Type
                t.joystickType = (ETCJoystick.JoystickType)EditorGUILayout.EnumPopup("Type", t.joystickType);

                if (t.joystickType == ETCJoystick.JoystickType.Static)
                {
                    t.anchor = (ETCBase.RectAnchor)EditorGUILayout.EnumPopup("Anchor", t.anchor);
                    if (t.anchor != ETCBase.RectAnchor.UserDefined)
                    {
                        t.anchorOffet = EditorGUILayout.Vector2Field("Offset", t.anchorOffet);
                    }

                    t.IsNoOffsetThumb = ETCGuiTools.Toggle("No offset thumb", t.IsNoOffsetThumb, true);

                    //	if (t.isNoOffsetThumb) t.isNoReturn = false;
                    t.IsNoReturnThumb = ETCGuiTools.Toggle("No return of the thumb", t.IsNoReturnThumb, true);
                }
                else if (t.joystickType == ETCJoystick.JoystickType.Dynamic)
                {
                    t.anchor = ETCBase.RectAnchor.UserDefined;
                    t.allowJoystickOverTouchPad = ETCGuiTools.Toggle("Allow over touchpad", t.allowJoystickOverTouchPad, true);
                    t.joystickArea = (ETCJoystick.JoystickArea)EditorGUILayout.EnumPopup("Joystick area", t.joystickArea);
                    if (t.joystickArea == ETCJoystick.JoystickArea.UserDefined)
                    {
                        t.userArea = (RectTransform)EditorGUILayout.ObjectField("User area", t.userArea, typeof(RectTransform), true);
                    }
                }

                EditorGUILayout.Space();

                // Area sprite ratio
                Rect  rect  = t.GetComponent <Image>().sprite.rect;
                float ratio = rect.width / rect.height;

                // Area Size
                if (ratio >= 1)
                {
                    float s = EditorGUILayout.FloatField("Background size", t.rectTransform().rect.width);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s / ratio);
                }
                else
                {
                    float s = EditorGUILayout.FloatField("Background size", t.rectTransform().rect.height);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s);
                    t.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s * ratio);
                }

                // Thumb sprite ratio
                rect  = t.thumb.GetComponent <Image>().sprite.rect;
                ratio = rect.width / rect.height;

                // Thumb size
                if (ratio >= 1)
                {
                    float s = EditorGUILayout.FloatField("Thumb size", t.thumb.rectTransform().rect.width);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s / ratio);
                }
                else
                {
                    float s = EditorGUILayout.FloatField("Thumb size", t.thumb.rectTransform().rect.height);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, s);
                    t.thumb.rectTransform().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, s * ratio);
                }

                EditorGUILayout.Space();

                t.radiusBase = (ETCJoystick.RadiusBase)EditorGUILayout.EnumPopup("Radius based on", t.radiusBase);
                if (t.radiusBase == ETCJoystick.RadiusBase.UserDefined)
                {
                    t.radiusBaseValue = EditorGUILayout.FloatField("Radius", t.radiusBaseValue);
                }
                EditorGUILayout.Space();
            }
            ETCGuiTools.EndGroup();
        }
        #endregion

        #region Axes properties
        t.showAxesInspector = ETCGuiTools.BeginFoldOut("Axes properties", t.showAxesInspector);
        if (t.showAxesInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                EditorGUILayout.Space();

                ETCGuiTools.BeginGroup(5);
                {
                    t.enableKeySimulation = ETCGuiTools.Toggle("Enable Unity axes", t.enableKeySimulation, true);
                    if (t.enableKeySimulation)
                    {
                        t.allowSimulationStandalone = ETCGuiTools.Toggle("Allow Unity axes on standalone", t.allowSimulationStandalone, true);
                        t.visibleOnStandalone       = ETCGuiTools.Toggle("Force visible", t.visibleOnStandalone, true);
                    }
                }
                ETCGuiTools.EndGroup();

                EditorGUILayout.Space();

                ETCGuiTools.BeginGroup(5);
                {
                    //t.isTurnAndMove = EditorGUILayout.ToggleLeft("Enable Turn & Move direction Action",t.isTurnAndMove);
                    t.isTurnAndMove = ETCGuiTools.Toggle("Turn & Move direction Action", t.isTurnAndMove, true, 220, true);
                    if (t.isTurnAndMove)
                    {
                        TurnAndMove(t.axisX, t.axisY, t);
                    }
                }
                ETCGuiTools.EndGroup();

                //EditorGUILayout.Space();

                ETCGuiTools.BeginGroup(5);
                {
                    ETCAxisInspector.AxisInspector(t.axisX, "Horizontal", ETCBase.ControlType.Joystick, t.isTurnAndMove, unityAxes);
                }
                ETCGuiTools.EndGroup();

                ETCGuiTools.BeginGroup(5);
                {
                    ETCAxisInspector.AxisInspector(t.axisY, "Vertical", ETCBase.ControlType.Joystick, t.isTurnAndMove, unityAxes);
                }
                ETCGuiTools.EndGroup();
            }
            ETCGuiTools.EndGroup();
        }
        #endregion

        #region Camera
        t.showCameraInspector = ETCGuiTools.BeginFoldOut("Camera", t.showCameraInspector);
        if (t.showCameraInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                EditorGUILayout.Space();
                t.enableCamera = ETCGuiTools.Toggle("Enable tracking", t.enableCamera, true);
                if (t.enableCamera)
                {
                    EditorGUILayout.Space();

                    // Auto link
                    ETCGuiTools.BeginGroup(5);
                    {
                        t.autoLinkTagCam = EditorGUILayout.ToggleLeft("Auto link on tag", t.autoLinkTagCam);
                        if (t.autoLinkTagCam)
                        {
                            t.autoCamTag = EditorGUILayout.TagField("", t.autoCamTag);
                        }
                        else
                        {
                            t.cameraTransform = (Transform)EditorGUILayout.ObjectField("Camera", t.cameraTransform, typeof(Transform), true);
                        }
                    }
                    ETCGuiTools.EndGroup();

                    EditorGUILayout.Space();

                    ETCGuiTools.BeginGroup(5);
                    {
                        t.cameraTargetMode = (ETCJoystick.CameraTargetMode)EditorGUILayout.EnumPopup("Target mode", t.cameraTargetMode);
                        if (t.cameraTargetMode == ETCBase.CameraTargetMode.UserDefined)
                        {
                            t.cameraLookAt = (Transform)EditorGUILayout.ObjectField("Camera target", t.cameraLookAt, typeof(Transform), true);
                        }
                        if (t.cameraTargetMode == ETCBase.CameraTargetMode.LinkOnTag)
                        {
                            t.camTargetTag = EditorGUILayout.TagField("", t.camTargetTag);
                        }
                    }
                    ETCGuiTools.EndGroup();

                    EditorGUILayout.Space();

                    ETCGuiTools.BeginGroup(5);
                    {
                        t.cameraMode = (ETCJoystick.CameraMode)EditorGUILayout.EnumPopup("Camera mode", t.cameraMode);
                        switch (t.cameraMode)
                        {
                        case ETCJoystick.CameraMode.Follow:
                            t.followOffset = EditorGUILayout.Vector3Field("Offset", t.followOffset);
                            break;

                        case ETCJoystick.CameraMode.SmoothFollow:
                            t.enableWallDetection = EditorGUILayout.Toggle("Wall detection", t.enableWallDetection);
                            if (t.enableWallDetection)
                            {
                                SerializedObject   so    = new SerializedObject(t);
                                SerializedProperty layer = so.FindProperty("wallLayer");
                                EditorGUILayout.PropertyField(layer, true);
                                so.ApplyModifiedProperties();
                            }
                            EditorGUILayout.Space();
                            t.followDistance        = EditorGUILayout.FloatField("Distance", t.followDistance);
                            t.followHeight          = EditorGUILayout.FloatField("Height", t.followHeight);
                            t.followHeightDamping   = EditorGUILayout.FloatField("Height damping", t.followHeightDamping);
                            t.followRotationDamping = EditorGUILayout.FloatField("Rotation dampping", t.followRotationDamping);
                            break;
                        }
                    }
                    ETCGuiTools.EndGroup();
                }
            }
            ETCGuiTools.EndGroup();
        }
        #endregion

        #region sprites
        t.showSpriteInspector = ETCGuiTools.BeginFoldOut("Sprites", t.showSpriteInspector);
        if (t.showSpriteInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                #region Background
                Sprite areaSprite = t.GetComponent <Image>().sprite;

                EditorGUILayout.BeginHorizontal();
                t.GetComponent <Image>().sprite = (Sprite)EditorGUILayout.ObjectField("Background", t.GetComponent <Image>().sprite, typeof(Sprite), true, GUILayout.MinWidth(100));
                t.GetComponent <Image>().color  = EditorGUILayout.ColorField("", t.GetComponent <Image>().color, GUILayout.Width(50));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
                Rect spriteRect = new Rect(areaSprite.rect.x / areaSprite.texture.width,
                                           areaSprite.rect.y / areaSprite.texture.height,
                                           areaSprite.rect.width / areaSprite.texture.width,
                                           areaSprite.rect.height / areaSprite.texture.height);
                GUILayout.Space(8);
                Rect lastRect = GUILayoutUtility.GetLastRect();
                lastRect.x      = 20;
                lastRect.width  = 100;
                lastRect.height = 100;

                GUILayout.Space(100);

                ETCGuiTools.DrawTextureRectPreview(lastRect, spriteRect, t.GetComponent <Image>().sprite.texture, Color.white);
                #endregion
                EditorGUILayout.Space();
                #region thumb
                Sprite thumbSprite = t.thumb.GetComponent <Image>().sprite;

                EditorGUILayout.BeginHorizontal();
                t.thumb.GetComponent <Image>().sprite = (Sprite)EditorGUILayout.ObjectField("Thumb", t.thumb.GetComponent <Image>().sprite, typeof(Sprite), true, GUILayout.MinWidth(100));
                t.thumb.GetComponent <Image>().color  = EditorGUILayout.ColorField("", t.thumb.GetComponent <Image>().color, GUILayout.Width(50));
                EditorGUILayout.EndHorizontal();

                spriteRect = new Rect(thumbSprite.rect.x / thumbSprite.texture.width,
                                      thumbSprite.rect.y / thumbSprite.texture.height,
                                      thumbSprite.rect.width / thumbSprite.texture.width,
                                      thumbSprite.rect.height / thumbSprite.texture.height);

                GUILayout.Space(8);
                lastRect        = GUILayoutUtility.GetLastRect();
                lastRect.x      = 20;
                lastRect.width  = 100;
                lastRect.height = 100;

                GUILayout.Space(100);

                ETCGuiTools.DrawTextureRectPreview(lastRect, spriteRect, t.thumb.GetComponent <Image>().sprite.texture, Color.white);

                #endregion
            }
            ETCGuiTools.EndGroup();
        }
        #endregion

        #region Events
        t.showEventInspector = ETCGuiTools.BeginFoldOut("Move Events", t.showEventInspector);
        if (t.showEventInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                serializedObject.Update();
                SerializedProperty moveStartEvent = serializedObject.FindProperty("onMoveStart");
                EditorGUILayout.PropertyField(moveStartEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty moveEvent = serializedObject.FindProperty("onMove");
                EditorGUILayout.PropertyField(moveEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty moveSpeedEvent = serializedObject.FindProperty("onMoveSpeed");
                EditorGUILayout.PropertyField(moveSpeedEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty moveEndEvent = serializedObject.FindProperty("onMoveEnd");
                EditorGUILayout.PropertyField(moveEndEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            }
            ETCGuiTools.EndGroup();
        }

        t.showTouchEventInspector = ETCGuiTools.BeginFoldOut("Touch Events", t.showTouchEventInspector);
        if (t.showTouchEventInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                serializedObject.Update();
                SerializedProperty touchStartEvent = serializedObject.FindProperty("onTouchStart");
                EditorGUILayout.PropertyField(touchStartEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty touchUpEvent = serializedObject.FindProperty("onTouchUp");
                EditorGUILayout.PropertyField(touchUpEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            }
            ETCGuiTools.EndGroup();
        }

        t.showDownEventInspector = ETCGuiTools.BeginFoldOut("Down Events", t.showDownEventInspector);
        if (t.showDownEventInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                serializedObject.Update();
                SerializedProperty downUpEvent = serializedObject.FindProperty("OnDownUp");
                EditorGUILayout.PropertyField(downUpEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty downRightEvent = serializedObject.FindProperty("OnDownRight");
                EditorGUILayout.PropertyField(downRightEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty downDownEvent = serializedObject.FindProperty("OnDownDown");
                EditorGUILayout.PropertyField(downDownEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty downLeftEvent = serializedObject.FindProperty("OnDownLeft");
                EditorGUILayout.PropertyField(downLeftEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            }
            ETCGuiTools.EndGroup();
        }

        t.showPressEventInspector = ETCGuiTools.BeginFoldOut("Press Events", t.showPressEventInspector);
        if (t.showPressEventInspector)
        {
            ETCGuiTools.BeginGroup();
            {
                serializedObject.Update();
                SerializedProperty pressUpEvent = serializedObject.FindProperty("OnPressUp");
                EditorGUILayout.PropertyField(pressUpEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty pressRightEvent = serializedObject.FindProperty("OnPressRight");
                EditorGUILayout.PropertyField(pressRightEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty pressDownEvent = serializedObject.FindProperty("OnPressDown");
                EditorGUILayout.PropertyField(pressDownEvent, true, null);
                serializedObject.ApplyModifiedProperties();

                serializedObject.Update();
                SerializedProperty pressLeftEvent = serializedObject.FindProperty("OnPressLeft");
                EditorGUILayout.PropertyField(pressLeftEvent, true, null);
                serializedObject.ApplyModifiedProperties();
            }
            ETCGuiTools.EndGroup();
        }

        #endregion

        if (t.anchor != ETCBase.RectAnchor.UserDefined && t.joystickType == ETCJoystick.JoystickType.Static)
        {
            t.SetAnchorPosition();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(t);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
        }
    }
Пример #20
0
	public static void SetTurnMoveSpeed(string ctrlName, float speed){
		ETCJoystick joy = GetControlJoystick( ctrlName);
		if (joy){
			joy.tmSpeed = speed;
		}
	}
Пример #21
0
 void Start()
 {
     joyStick = GetComponent <ETCJoystick>();
     joyStick.onMove.AddListener(OnMove);
 }
Пример #22
0
    void Start()
    {
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera");

        npc_egg      = GameObject.Find("npc_egg");
        npc_dragon   = GameObject.Find("npc_dragon");
        dia_firetree = GameObject.Find("dia_fireTree");
        npc_villager = GameObject.Find("npc_villager");
        dia_stopcold = GameObject.Find("dia_stopcold");
        dia_dark     = GameObject.Find("dia_dark");
        dia_outdark  = GameObject.Find("dia_outdark");
        dia_meetBoss = GameObject.Find("dia_meetBoss");


        npc_dragon.SetActive(false);

        joystick = ETCInput.GetControlJoystick("Joystick");
        button_B = ETCInput.GetControlButton("Button_B");
        button_J = ETCInput.GetControlButton("Button_J");
        button_K = ETCInput.GetControlButton("Button_K");

        // 记得修改false
        button_J.visible = false;

        player_bullet = (GameObject)Resources.Load("Prefabs/fireball");

        Dark_Mesh = GameObject.Find("DarkMesh");
        Dark      = GameObject.Find("Dark");
        Dark_Mesh.SetActive(false);
        Dark.SetActive(false);

        photo     = GameObject.Find("Photo");
        photo_Big = GameObject.Find("Photo_Big");
        photo.SetActive(false);
        photo_Big.SetActive(false);

        //DeathUI = GameObject.Find("Death");
        DeathUI.SetActive(false);

        playerUI = GameObject.Find("playerUI");
        playerUI.SetActive(false);

        FinalDia = GameObject.Find("FinalDia");
        bt1      = GameObject.Find("bt1");
        bt2      = GameObject.Find("bt2");
        bt3      = GameObject.Find("bt3");
        bt4      = GameObject.Find("bt4");
        bt5      = GameObject.Find("bt5");
        FinalDia.SetActive(false);
        bt2.SetActive(false);
        bt3.SetActive(false);
        bt4.SetActive(false);
        bt5.SetActive(false);


        hp[0] = GameObject.Find("Canvas/Life/HP1");
        hp[1] = GameObject.Find("Canvas/Life/HP2");
        hp[2] = GameObject.Find("Canvas/Life/HP3");
        hp[3] = GameObject.Find("Canvas/Life/HP4");
        hp[4] = GameObject.Find("Canvas/Life/HP5");
        hp[5] = GameObject.Find("Canvas/Life/HP6");

        blockway = GameObject.Find("blockWay");
        blockway.SetActive(false);
    }
Пример #23
0
 private void Init()
 {
     m_transform = this.transform as RectTransform;
     _joystick = m_transform.GetComponent<ETCJoystick>();
 }
Пример #24
0
 private void Awake()
 {
     playerjoy = GameObject.Find("PlayerJoystick").GetComponent <ETCJoystick>();
     hookjoy   = GameObject.Find("HookJoystick").GetComponent <ETCJoystick>();
 }