Beispiel #1
0
    /// <summary>
    /// 激活事件
    /// </summary>
    /// <param name="eventID"></param>
    public void ActiveEvent(SCDiceStruct curEvent, ZillionaireGameMapGridDefInfo gridInfo, Action callback)
    {
        ActionEventCallback  = callback;
        _curDiceCallbackInfo = curEvent;

        SortEvent(gridInfo);
    }
Beispiel #2
0
 /// <summary>
 /// 玩家进入到x格子上
 /// </summary>
 public void PlayerEnterGrid(ZillionaireGameMapGridDefInfo gridData, bool isDelivery = false)
 {
     _curGridID = gridData.ID;
     //隐藏格子icon
     gridData.HideIcon(true);
     EnterOrigin(gridData, false, isDelivery);
 }
Beispiel #3
0
    /// <summary>
    /// 设置玩家到目标格子
    /// </summary>
    /// <param name="gridData"></param>
    public void SetPlayerTargetGuid(ZillionaireGameMapGridDefInfo gridData)
    {
        _currGridData = gridData;
        //隐藏格子icon
        gridData.HideIcon(false);
        Vector3 point     = _currGridData.WorldPosition;
        Vector3 tagePoint = transform.parent.InverseTransformPoint(point);

        transform.localPosition = tagePoint;
    }
Beispiel #4
0
    /// <summary>
    /// 生成/加载角色
    /// </summary>
    /// <param name="isEnterGame"> 是否是进入游戏 </param>
    /// <param name="roleID"></param>
    /// <param name="gridData"></param>
    private async void LoadPlayer(bool isEnterGame, int roleID = 0, ZillionaireGameMapGridDefInfo gridData = null)
    {
        if (_currentPlayer == null)
        {
            GameObject Obj = await ABManager.GetAssetAsync <GameObject>(GetRoleAssetName(roleID));

            GameObject playerObj = ZillionaireManager.Instantiate(Obj, ZillionaireManager._instance.transform);
            //playerObj.SetActive(true);
            _currentPlayer = playerObj.GetComponent <ZillionairePlayerControl>();
        }
        _currentPlayer.gameObject.SetActive(false);
        if (isEnterGame)
        {
            Debug.Log("生成角色 进入大富翁游戏!");
            _currentPlayer.gameObject.SetActive(true);
            _currentPlayer.EnterOrigin(gridData);
        }
    }
Beispiel #5
0
    /// <summary>
    /// 进入起点 会重置玩家数据
    /// </summary>
    /// <param name="gridData"></param>
    /// <param name="isReset"></param>
    /// <param name="isDelivery"></param>
    public void EnterOrigin(ZillionaireGameMapGridDefInfo gridData, bool isReset = true, bool isDelivery = false)
    {
        if (isReset)
        {
            ResetPlayerData();
        }

        SetPlayerTargetGuid(gridData);
        transform.localScale = new Vector3(0.16f, 0.16f, 1f);
        //出场动画
        if (isReset)
        {
            PlayRoleAnim(PlayerAnimDirection.Down, PlayerAnimType.Appearance);
        }
        if (isDelivery)
        {
            PlayRoleAnim(PlayerAnimDirection.Down, PlayerAnimType.Idle, true);
        }
    }
Beispiel #6
0
    /// <summary>
    /// 获取格子地图
    /// </summary>
    private void GetMapGridData()
    {
        _mapGridDic.Clear();

        ZillionaireLatticeDataDefine grid = null;

        //获取地图配置格子数据 //格子下标 重0开始
        for (int i = 0; i < _curSelectMap.MapGridMax.Count; i++)
        {
            grid = StaticData.configExcel.GetZillionaireLatticeDataByID(_curSelectMap.MapGridMax[i]);
            //获取格子并且初始化值
            Transform itemObj = transform.GetChild(i);//根据下标获取格子 重0开始
            ZillionaireGameMapGridDefInfo gridDefInfo = itemObj.GetComponent <ZillionaireGameMapGridDefInfo>();
            gridDefInfo.InitValue(i, grid);
            //事件
            //CurMapEventManager.AddMapEvent(item.Value.ZillionaireGameAwardId, item.Value.ZillionaireGameId - 1, this);
            _mapGridDic.Add(i, gridDefInfo);
        }
    }
Beispiel #7
0
    /// <summary>
    /// 当前这一步移动完成
    /// </summary>
    private void CurStepMoveEnd()
    {
        //
        _moveGrids[_moveIndex].ActiveTransparentCoverEffect(false);

        //更新当前格子
        _currGridData = _moveGrids[_moveIndex];

        int nextMoveIndex = _moveIndex + 1;

        if (nextMoveIndex >= _moveGrids.Count)
        {
            CurMoveCompleted();
        }
        else
        {
            _moveIndex = nextMoveIndex;
            StartMovePlayAnim();
        }
    }
Beispiel #8
0
    /// <summary>
    /// 奖励翻倍事件
    /// </summary>
    private void RewardDoubledEvent(ZillionaireEventDefine curEvent, ZillionaireGameMapGridDefInfo gridInfo)
    {
        //1.播放动画效果 翻倍数量在动效中表现
        //2.获得奖励效果
        int baseNum = (int)gridInfo.GridInfo.BasicReward.Count;

        //金币进行等级计算
        if (gridInfo.GridInfo.BasicReward.ID == StaticData.configExcel.GetVertical().GoldGoodsId)
        {
            baseNum = ZillionaireToolManager.GetGridBaseReward(baseNum);
        }

        baseNum *= curEvent.Effect;
        //暂存玩家获得的奖励
        ZillionairePlayerManager._instance.CurrentPlayer.AddPlayerRewards(gridInfo.GridInfo.BasicReward.ID, baseNum);
        //发放体力奖励 + 播放角色获得动画
        ZillionairePlayerManager._instance.CurrentPlayer.IssueCurrentRewards();
        //通知格子播放获得奖励效果
        gridInfo.PlayPickupItemEffect(true);
        //完成
        EventEnd();
    }
Beispiel #9
0
    /// <summary>
    /// 播放事件提示
    /// </summary>
    /// <param name="curEvent"></param>
    private async void PlayEffectTips(ZillionaireGameMapGridDefInfo gridInfo, ZillionaireEventDefine curEvent)
    {
        Debug.Log("播放事件提示 11");
        GameObject eventEffect = null;

        if (!gridInfo.IsActiveEvent)
        {
            Debug.Log("播放事件提示 12");
            eventEffect = await SpawnPrefabOrdinary();

            Vector3 pos = gridInfo.GetItemEffectStartPos();
            //将屏幕坐标转换到transform的局部坐标中
            Vector2 V2InAt;
            RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)eventEffect.transform.parent, pos, Camera.main, out V2InAt);
            eventEffect.transform.localPosition = V2InAt;
        }
        else
        {
            Debug.Log("播放事件提示 13");
            eventEffect = await SpawnPrefabRandom();
        }
        eventEffect.GetComponent <ZillionaireOrdinaryEventEffectController>().InitValue(curEvent.ID);
        Debug.Log("播放事件提示 14");
    }
Beispiel #10
0
    /// <summary>
    /// 分类事件/将事件进行分类处理
    /// </summary>
    /// <param name="eventID"></param>
    private async void SortEvent(ZillionaireGameMapGridDefInfo gridInfo)
    {
        int eventID = 0;

        if (gridInfo.IsActiveEvent)
        {
            eventID = gridInfo.GridInfo.EventSecond;
        }
        else
        {
            eventID = gridInfo.GridInfo.EventFirst;
        }
        Debug.Log("SortEvent 事件 id = " + eventID);
        ZillionaireEventDefine curEvent = StaticData.configExcel.GetZillionaireEventByID(eventID);

        //提示事件名称
        //StaticData.CreateToastTips(LocalizationDefineHelper.GetStringNameById(curEvent.EventNameID));
        PlayEffectTips(gridInfo, curEvent);
        //延时等待
        await UniTask.Delay(1200);

        switch (eventID)
        {
        case 1001:
            PhysicalStrengthEvent(curEvent);
            break;

        case 1002:
            PhysicalStrengthEvent(curEvent);
            break;

        case 1003:
            LotteryEvent(curEvent);
            break;

        case 1004:
            ChooseAPrizeEvent(curEvent);
            break;

        case 1006:
            VoteAgainEvent(curEvent);
            break;

        case 1007:
            RewardDoubledEvent(curEvent, gridInfo);
            break;

        case 2001:
            PhysicalStrengthEvent(curEvent);
            break;

        case 2002:
            LotteryEvent(curEvent);
            break;

        case 2004:
            RewardDoubledEvent(curEvent, gridInfo);
            break;

        case 2005:
            ChooseAPrizeEvent(curEvent);
            break;

        case 2006:
            RewardDoubledEvent(curEvent, gridInfo);
            break;

        case 2007:
            RandomDeliveryEvent(curEvent);
            break;

        case 2008:
            GrandSlamEvent(curEvent);
            break;

        case 2009:
            RewardDoubledEvent(curEvent, gridInfo);
            break;

        default:
            Debug.Log("StartEvent 没有注册的事件! eventID =" + eventID);
            break;
        }
    }
Beispiel #11
0
 /// <summary>
 /// 玩家进入 游戏
 /// </summary>
 public void PlayerEnter(ZillionaireGameMapGridDefInfo gridData)
 {
     LoadPlayer(true, 0, gridData);
 }