Ejemplo n.º 1
0
 /// <summary>
 /// 设置按键操作
 /// </summary>
 /// <param name="down">是否按下</param>
 /// <param name="mask">当前按键</param>
 public void SetKey(bool down, KeyNum mask)
 {
     if (sendKey != null)
     {
         sendKey.SetKey(down, mask);
     }
 }
Ejemplo n.º 2
0
 public void updateNumberAndSprite()
 {
     // Debug.Log("35 "+H_potion + " / " + S_potion + " /  "+Key);
     H_PotionNum.GetComponent <Text>().text = H_potion + " / " + maxH_potion;
     S_PotionNum.GetComponent <Text>().text = S_potion + " / " + maxS_potion;
     KeyNum.GetComponent <Text>().text      = Key + " / ?";
     if (H_potion <= 0)
     {
         H_potion = 0;
         H_PotionSlot.GetComponent <Image>().sprite = H_PotionSpriteGrey;
     }
     else
     {
         H_PotionSlot.GetComponent <Image>().sprite = H_PotionSprite;
     }
     if (S_potion <= 0)
     {
         S_potion = 0;
         S_PotionSlot.GetComponent <Image>().sprite = S_PotionSpriteGrey;
     }
     else
     {
         S_PotionSlot.GetComponent <Image>().sprite = S_PotionSprite;
     }
     if (Key <= 0)
     {
         Key = 0;
         KeySlot.GetComponent <Image>().sprite = KeySpriteGrey;
     }
     else
     {
         KeySlot.GetComponent <Image>().sprite = KeySprite;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 按键状态判断
 /// </summary>
 /// <param name="key">按键</param>
 public bool GetKey(KeyNum key){ 
   
     if((midKey&key)==key||(finalKey&key)==key){
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 解析byte信息为按键数据
        /// </summary>
        /// <param name="message">消息</param>
        public void Parse(ProtocolBase message) {
            Reset();

            midKey = (KeyNum)message.getByte();
            finalKey = (KeyNum)message.getByte();
           // UnityEngine.Debug.LogError("last[" + lastKey + "] mid[" + midKey + "] final[" + finalKey + "]");
        }
Ejemplo n.º 5
0
    private bool isShow;          //提示消息框2是否显示

    void Awake()
    {
        GameObject keyNumUI = GameObject.Find("UI Root/Camera/Anchor-TopRight/Panel/Key");

        //GameObject newsPanel = GameObject.Find("UI Root/Camera/Anchor-TopRight/NewsPanel");
        kn = keyNumUI.gameObject.GetComponent <KeyNum>();
    }
Ejemplo n.º 6
0
        /// <summary>
        /// 解析byte信息为按键数据
        /// </summary>
        /// <param name="message">消息</param>
        public void Parse(ProtocolBase message)
        {
            Reset();

            midKey   = (KeyNum)message.getByte();
            finalKey = (KeyNum)message.getByte();
        }
Ejemplo n.º 7
0
 SkillBase GetSkill(KeyNum key)
 {
     if (skillList != null && skillList.skillTable[joy.key].Count > 0)
     {
         return(skillList.skillTable[joy.key][0]);
     }
     return(null);
 }
Ejemplo n.º 8
0
 public void SetKey(KeyNum key,KeyNum mask){
     if((mask&lastKey)!=key){
         midKey=(midKey&~mask)|key;
         finalKey=midKey;
     }else if((mask&midKey)!=key){
         finalKey=(finalKey&~mask)|key;
     }
 }
Ejemplo n.º 9
0
 SkillRuntime GetSkill(KeyNum key)
 {
     if (skillList != null)
     {
         return(skillList.GetSkill(key));
     }
     return(null);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 按键抬起操作判断
 /// </summary>
 /// <param name="key">按键</param>
 public bool GetKeyUp(KeyNum key)
 {
     if (((lastKey & key) == key && (midKey & key) != key) || ((midKey & key) == key && (finalKey & key) != key))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 11
0
 public override void Deserialize(ByteProtocol protocol)
 {
     skillId = (SkillId)protocol.getInt32();
     //    UnityEngine.Debug.LogError("get skillId" +(Int32)skillId);
     coolDownTime = protocol.getRatio();
     animTime     = protocol.getRatio();
     key          = (KeyNum)protocol.getByte();
     base.Deserialize(protocol);
 }
Ejemplo n.º 12
0
    public SkillRuntime GetSkill(KeyNum key)
    {
        SkillRuntime skill = null;

        if (skillTable.ContainsKey(key))
        {
            skill = skillTable[key];
        }
        return(skill);
    }
Ejemplo n.º 13
0
 /// <summary>
 /// 获取按键对应的摇杆方向
 /// </summary>
 /// <param name="key">摇杆对应按键</param>
 /// <returns>摇杆方向</returns>
 public Fixed2 GetJoyStickDirection(KeyNum key)
 {
     if (joySticks.ContainsKey(key))
     {
         return(joySticks[key].direction.normalized);
     }
     else
     {
         return(Fixed2.zero);
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 设置按键操作
 /// </summary>
 /// <param name="mask">当前按键</param>
 /// <param name="joy">是否按下</param>
 public void SetJoyStick(KeyNum mask, JoyStickKey joy)
 {
     sendKey.SetKey(joy.key, mask);
     if (joySticks.ContainsKey(mask))
     {
         joySticks[mask] = joy;
     }
     else
     {
         joySticks.Add(mask, joy);
     }
 }
Ejemplo n.º 15
0
    private bool isShow;         //提示消息框是否显示

    void Awake()
    {
        GameObject numLabel = GameObject.Find("UI Root/Camera/Anchor-Center/KeySaleNumPanel/NumSprite/Label");

        buyNum = numLabel.gameObject.GetComponent <NumLabel>();
        GameObject key = GameObject.Find("UI Root/Camera/Anchor-TopRight/Panel/Key");

        keyNum = key.gameObject.GetComponent <KeyNum>();
        GameObject stone = GameObject.Find("UI Root/Camera/Anchor-TopRight/Panel/Stones");

        stonesNumber = stone.gameObject.GetComponent <Stones>();
    }
Ejemplo n.º 16
0
 public void SetJoyStickDirection(KeyNum key, Fixed2 direction)
 {
     if (joySticks.ContainsKey(key))
     {
         joySticks[key].direction = direction;
     }
     else
     {
         joySticks.Add(key, new JoyStickKey(key, direction));
     }
     Key.SetKey(true, key);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// 获取按键对应的摇杆方向
        /// </summary>
        /// <param name="key">摇杆对应按键</param>
        /// <returns>摇杆方向</returns>
        public Fixed2 GetJoyStickDirection(KeyNum key)
        {
            if (joySticks.ContainsKey(key))
            {
                return(joySticks[key].direction);
            }
            else
            {
                string test = "|||";
                foreach (var joy in joySticks)
                {
                    test += "[" + joy.Key + "]";
                }
                Debug.LogError("未同步的摇杆!!![" + key + "]" + test);

                return(Fixed2.zero);
            }
        }
Ejemplo n.º 18
0
 public JoyStickKey(KeyNum key, Fixed2 direction)
 {
     this.key       = key;
     this.direction = direction;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 按键按下操作判断
 /// </summary>
 /// <param name="key">按键</param>
 public bool GetKeyDown(KeyNum key){ 
     if(((lastKey&key)!=key&&(midKey&key)==key)||((midKey&key)!=key&&(finalKey&key)==key)){
         return true;  
     }
     return false;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 检测按键当前帧是否有抬起操作
 /// </summary>
 /// <param name="key">按键</param>
 public bool GetKeyUp(KeyNum key)
 {
     return(frameKey.GetKeyUp(key));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 检测按键当前帧是否有按下操作
 /// </summary>
 /// <param name="key">按键</param>
 public bool GetKeyDown(KeyNum key)
 {
     return(frameKey.GetKeyDown(key));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// 设置按键操作
 /// </summary>
 /// <param name="down">是否按下</param>
 /// <param name="mask">当前按键</param>
 public void SetKey(bool down, KeyNum mask)
 {
     sendKey.SetKey(down, mask);
 }
Ejemplo n.º 23
0
    /// <summary>
    /// 水中操作
    /// </summary>
    public void WaterInPlayerMove()
    {
        if (!SanMaterPlus.madFlag)
        {
            if (MoveCheack() == 1 || MoveCheack() == 2)
            {
                if (MoveCheack() == 1)
                {
                    aTimeX += Time.deltaTime;
                    AccelalationPlus(1);
                    moveSpeed.y *= breaking;
                }
                else if (MoveCheack() == 2)
                {
                    aTimeY += Time.deltaTime;
                    AccelalationPlus(2);
                    moveSpeed.x *= breaking;
                }
            }
            else if (MoveCheack() == 3)
            {
                aTimeX += Time.deltaTime;
                aTimeY += Time.deltaTime;
                AccelalationPlus(1);
                AccelalationPlus(2);
            }
            else if (MoveCheack() == 0)
            {
                moveSpeed.x *= breaking;
                moveSpeed.y *= breaking;
            }

            //左方向の入力
            if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
            {
                transform.localScale = new Vector3(-0.1f, 0.1f, 1);
                accelalationX        = 0;
                kNum = KeyNum.Left;
            }

            //右方向の入力
            if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
            {
                transform.localScale = new Vector3(0.1f, 0.1f, 1);
                accelalationX        = 0;
                kNum = KeyNum.Right;
            }

            //上方向の入力
            if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow))
            {
                accelalationY = 0;
                kNum          = KeyNum.Up;
            }

            //下方向の入力
            if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow))
            {
                accelalationY = 0;
                kNum          = KeyNum.Down;
            }
        }

        time += Time.deltaTime;
        if (time > 1)
        {
            OxygenUse();
            time = time - time;
        }
    }
Ejemplo n.º 24
0
        public void SetKey(bool down, KeyNum mask)
        {
            KeyNum key = down?mask:0;

            SetKey(key, mask);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// 重置操作信息
 /// </summary>
 public void Reset()
 {
     lastKey = finalKey;
     midKey  = finalKey;
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 重置操作信息
 /// </summary>
 protected void Reset(){
     lastKey=finalKey;
     midKey=finalKey;
 }
Ejemplo n.º 27
0
 public FrameKey()
 {
     lastKey  = (KeyNum)0;
     midKey   = (KeyNum)0;
     finalKey = (KeyNum)0;
 }