コード例 #1
0
ファイル: PreparingOps.cs プロジェクト: moto2002/Avocat
    public override void OnStartDragging(float x, float y)
    {
        if (currentSelAvatar != null)
        {
            currentSelAvatar.Color = MapAvatar.ColorDefault;
            currentSelAvatar       = null;
        }

        WorldPos2MapPos(x, y, out float gx, out float gy);
        var avatar = BattleStage.GetAvatarAt((int)gx, (int)gy);

        if (avatar == null || avatar.Warrior.Team != Room.PlayerMe)
        {
            base.OnStartDragging(x, y);
            return;
        }

        // 显示指针,并隐藏准备拖拽的对象
        currentSelAvatar = avatar;
        PointerIndicator.SetActive(true);
        PointerIndicator.GetComponent <PoniterIndicator>().SetIdleAnimation(currentSelAvatar);
        PointerIndicator.transform.position = currentSelAvatar.transform.position;
        dragPointerOffset = new Vector2(PointerIndicator.transform.position.x - x, PointerIndicator.transform.position.y - y);
        currentSelAvatar.gameObject.SetActive(false);
    }
コード例 #2
0
ファイル: UseMapItemOps.cs プロジェクト: moto2002/Avocat
    public override void OnEndDragging(float fx, float fy, float tx, float ty)
    {
        WorldPos2MapPos(tx, ty, out float tgx, out float tgy);
        var target = BattleStage.Avatars[(int)tgx, (int)tgy];

        if (currentSelItem != null && target != null && target.Warrior.Team != Room.PlayerMe)
        {
            Room.UseItem2(currentSelItem.Item as Avocat.ItemOnMap, target.Warrior); // 执行操作
        }
        // 隐藏指针
        PointerIndicator.SetActive(false);
        if (currentSelItem != null)
        {
            currentSelItem.gameObject.SetActive(true);
        }

        currentSelItem = null;
    }
コード例 #3
0
ファイル: UseMapItemOps.cs プロジェクト: moto2002/Avocat
    public override void OnStartDragging(float x, float y)
    {
        if (currentSelItem != null)
        {
            currentSelItem.Color = MapItem.ColorDefault;
            currentSelItem       = null;
        }

        WorldPos2MapPos(x, y, out float gx, out float gy);
        var item = BattleStage.Items[(int)gx, (int)gy];

        if (item == null)
        {
            return;
        }

        // 显示指针,并隐藏准备拖拽的对象
        currentSelItem = item;
        PointerIndicator.SetActive(true);
        PointerIndicator.GetComponentInChildren <TextMesh>().text = item.Item.ID;
        currentSelItem.gameObject.SetActive(false);
    }
コード例 #4
0
ファイル: PreparingOps.cs プロジェクト: moto2002/Avocat
    public override void OnEndDragging(float fx, float fy, float tx, float ty)
    {
        WorldPos2MapPos(fx, fy, out float gfx, out float gfy);
        WorldPos2MapPos(tx, ty, out float gtx, out float gty);
        var mapTile = BattleStage.GetMapTileAt((int)gtx, (int)gty);

        if (currentSelAvatar == null)
        {
            return;
        }

        // 隐藏指针,执行交换操作,并显示被拖拽对象
        PointerIndicator.SetActive(false);
        currentSelAvatar.gameObject.SetActive(true);
        currentSelAvatar.IsShowClickFrame = false;
        currentSelAvatar = null;

        if (mapTile != null && mapTile.MapData.RespawnForChamp == false)
        {
            return;
        }
        Room.DoExchangeWarroirsPosition((int)gfx, (int)gfy, (int)gtx, (int)gty);
    }