private void OnTestMultiIntCD()
 {
     //multiTickObj = new MultiIntCD();
     LogWarp.LogErrorFormat("运行并添加 multiTickObj");
     //multiTickObj.Run();
     //multiTickObj.AddCD(1000, Test01);
     //multiTickObj.AddCD(5000, Test02);
 }
    /// <summary>
    /// 返回当前等级在等级段的差距
    /// </summary>
    /// <param name="array"></param>
    /// <param name="level"></param>
    /// <returns></returns>
    private int GetNeedUpLv(int[] array, int level)
    {
        int idx    = PlayerDataModule.FindLevelRangIndex(array, level);
        int needLv = array[idx] - level;

        LogWarp.LogErrorFormat(" 测试:      当前等级    {0}    在数组下标{1}    需要的等级{2} ", level, idx, needLv);
        return(needLv);
    }
        protected void OnNotFoundMessage(int messageID)
        {
            if (messageID < 10001)
            {
                LogWarp.LogErrorFormat("消息未注册  {0}", (UFrameBuildinMessage)messageID);
                return;
            }

            LogWarp.LogErrorFormat("消息未注册  {0}  {1}", (GameMessageDefine)messageID, (int)(GameMessageDefine)messageID);
        }
Beispiel #4
0
        public void AddLittleZooBuildinPos(LittleZooBuildinPos littleZooBuildinPos)
        {
            if (littleZooBuildinPosMap.ContainsKey(littleZooBuildinPos.LittleZooID))
            {
                LogWarp.LogErrorFormat("动物栏内置点重复 {0}", littleZooBuildinPos.LittleZooID);
                return;
            }

            littleZooBuildinPosMap.Add(littleZooBuildinPos.LittleZooID, littleZooBuildinPos);
        }
    protected void OnTestBuffReturn()
    {
        var buffList = GlobalDataManager.GetInstance().playerData.playerZoo.buffList;

        //var offlineBuffList01 = PlayerDataModule.OnGetBuffCoefficient(buffList);

        foreach (var item in buffList)
        {
            LogWarp.LogErrorFormat("测试: offlineBuffList:  buffID={0},  buff使用时间={1},buff还剩时间={2}, buff类型={3},  buff值={4}     加倍系数{5}",
                                   item.buffID, item.CD.org, item.CD.cd, item.buffType, item.buffVal, PlayerDataModule.PlayerRatioCoinInComeMul());
        }
    }
        protected void OnBroadcastForwardOneStepInExitGateQueue(Message msg)
        {
            var _msg   = msg as BroadcastForwardOneStepInExitGateQueue;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.entityIDs.IndexOf(entity.entityID) < 0)
            {
                return;
            }

            entity.numOfExitGateQueueForwardOne++;

            LogWarp.LogErrorFormat("{0} GotoExitEntryQueue recv {1}, entity.numOfExitGateQueueForwardOne={2}", entity.entityID, _msg, entity.numOfExitGateQueueForwardOne);
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} GotoExitEntryQueue recv {1}, entity.numOfExitGateQueueForwardOne={2}", entity.entityID, _msg, entity.numOfExitGateQueueForwardOne);
        }
    private void OnGetIsLockAdsSucceedBool(bool isBool)
    {
        if (isBool)
        {
            LogWarp.LogErrorFormat("测试:   看视频成功");
            switch (adTagFM)
            {
            case AdTagFM.Add_Double_Advert:
                LockAdsSucceed_Double();
                break;

            case AdTagFM.Add_Tourist_Advert:
                LockAdsSucceed_Tourist();
                break;

            case AdTagFM.Add_Ticket_Advert:
                LockAdsSucceed_Ticket();
                break;

            case AdTagFM.Add_Visit_Advert:
                LockAdsSucceed_Visit();
                break;

            case AdTagFM.Add_Offline_Advert:
                LockAdsSucceed_Offline();
                break;

            case AdTagFM.Add_Viptiming_Advert:
                LockAdsSucceed_FreeItem();
                break;

            default:
                break;
            }
            //利用dotweeen做延时操作 防止穿透
            float timeCount = 0.1f;
            DOTween.To(() => timeCount, a => timeCount = a, 0.1f, 0.1f).OnComplete(new TweenCallback(delegate
            {
                OnClickCloseButton("");
            }));
        }
        else
        {
            LogWarp.LogErrorFormat("测试:   看视频失败");
        }
    }
Beispiel #8
0
        public override void WhenCannotMoveTo(Vector2 moveTo)
        {
            Vector2 camPos2D = Math_F.Vector3_2D(cacheTrans.position);
            Vector2 tryPos   = camPos2D + (moveTo - camPos2D).normalized * 0.5f;

#if UNITY_EDITOR
            Vector3 tryPos3D = cacheTrans.position;
            tryPos3D.x        = tryPos.x;
            tryPos3D.z        = tryPos.y;
            tryPoint.position = tryPos3D;

            Vector3 moveToPos3D = cacheTrans.position;
            moveToPos3D.x        = moveTo.x;
            moveToPos3D.z        = moveTo.y;
            moveToPoint.position = moveToPos3D;
#endif
            Vector2 lineStart;
            int     idxStart;
            Vector2 lineEnd;
            int     idxEnd;
            Vector2 crossPos = Math_F.GetClosestCrossPoint(tryPos, cameraArea, out lineStart, out idxStart, out lineEnd, out idxEnd);
#if UNITY_EDITOR
            LogWarp.LogErrorFormat("WhenCannotMoveTo moveToPoint={0}, crossPos={1}, lineStart={2}, idxStart={3}, lineEnd={4}, idxEnd={5}",
                                   moveToPos3D, crossPos, lineStart, idxStart, lineEnd, idxEnd);
#endif
            bool    isCrossInLine = false;
            Vector2 crossDir      = Vector2.zero;
            for (int i = 0; i < cameraArea.Count; i++)
            {
                if (Math_F.Approximate2D(crossPos, cameraArea[i], 0.5f))
                {
                    LogWarp.LogErrorFormat("WhenCannotMoveTo crossPos == {0}", i);
                    isCrossInLine = true;
                    crossDir      = (cameraArea[(i + 1) % cameraArea.Count] - cameraArea[i]).normalized;
                    break;
                }
            }
            //Debug.LogError("GetClosestCrossPoint");
            //if (Math_F.IsPointInPolygon(crossPos, cameraArea))
            {
                //Debug.LogError("IsPointInPolygon");
                Vector3 camPos3D = cacheTrans.position;
                camPos3D.x = crossPos.x;
                camPos3D.z = crossPos.y;

#if UNITY_EDITOR
                crossPoint.position = camPos3D;
#endif

                switch (dragType)
                {
                case DragType.Normal:
                    cacheTrans.position = camPos3D;
                    break;

                case DragType.NormalPlus:
                    if (!isCrossInLine)
                    {
                        dragSmoothDir = (lineEnd - lineStart).normalized * crossSensitivity;
                        float dot = Vector2.Dot((moveTo - camPos2D).normalized, (lineEnd - lineStart).normalized);
                        if (dot < 0)
                        {
                            dragSmoothDir *= -1f;
                        }
                    }
                    else
                    {
                        dragSmoothDir = crossDir * crossSensitivity;
                    }

                    break;

                default:
                    string e = string.Format("不支持滑动类型{0}", dragType);
                    throw new System.Exception(e);
                }
            }
        }
    /// <summary>
    /// 将m_data转为AdTagFM类型
    /// </summary>
    /// <returns></returns>
    private AdTagFM InitCompentToAdTagFM()
    {
        int playerWatchAdsVideoCount = playerNumberOfVideosWatched.playerWatchAdsVideoCount;
        int advertRewardNumber       = Config.globalConfig.getInstace().AdvertRewardNumber;
        int advertRewardRmbNumber    = Config.globalConfig.getInstace().AdvertRewardRmbNumber;

        GoldText.text            = string.Format(GetL10NString("Ui_Text_127"), playerWatchAdsVideoCount, advertRewardNumber);
        Schedule_Slider.value    = AddPercentage(playerWatchAdsVideoCount, advertRewardNumber);
        ButtonBg_GoldNum.text    = string.Format(GetL10NString("Ui_Text_128"), advertRewardRmbNumber);
        ButtonBg_ButtonText.text = GetL10NString("Ui_Text_27");
        SwitchButtonUnClickable(advertButton, true);

        AdTagFM adTagFM = AdTagFM.Add_Double_Advert;

        if (m_data != null)
        {
            var isAdTagFM = m_data.ToString();
            switch (isAdTagFM)
            {
            case "Add_Double_Advert":
                adTagFM = AdTagFM.Add_Double_Advert;
                LogWarp.LogErrorFormat(" 视频UI  {0}    翻倍广告视频 ", isAdTagFM);
                InitCompent_Double();

                break;

            case "Add_Tourist_Advert":
                adTagFM = AdTagFM.Add_Tourist_Advert;
                LogWarp.LogErrorFormat(" 视频UI  {0}    增加游客广告视频 ", isAdTagFM);
                InitCompent_Tourist();

                break;

            case "Add_Ticket_Advert":
                adTagFM = AdTagFM.Add_Ticket_Advert;
                LogWarp.LogErrorFormat(" 视频UI  {0}    快速售票广告视频 ", isAdTagFM);
                InitCompent_Ticket();

                break;

            case "Add_Visit_Advert":
                adTagFM = AdTagFM.Add_Visit_Advert;
                LogWarp.LogErrorFormat(" 视频UI  {0}    快速观光广告视频 ", isAdTagFM);
                InitCompent_Visit();

                break;

            case "Add_Offline_Advert":
                adTagFM = AdTagFM.Add_Offline_Advert;
                LogWarp.LogErrorFormat(" 视频UI  {0}    离线广告视频 ", isAdTagFM);
                InitCompent_Offline();

                break;

            case "Add_Viptiming_Advert":
                adTagFM = AdTagFM.Add_Viptiming_Advert;
                LogWarp.LogErrorFormat(" 视频UI  {0}    免费广告视频 ", isAdTagFM);
                InitCompent_Viptiming();

                break;

            default:

                break;
            }
        }

        return(adTagFM);
    }
    public void SetNumberOfVideoViews(AdTagFM adTagFM)
    {
        switch (adTagFM)
        {
        case AdTagFM.Add_Double_Advert:
            if (playerLockGainDoubleAdsVideoCount < Config.globalConfig.getInstace().GoldRewardMaxNumber)
            {
                playerLockGainDoubleAdsVideoCount += 1;
                if (playerLockGainDoubleAdsVideoCount == Config.globalConfig.getInstace().GoldRewardMaxNumber)
                {
                    var rewardNumCoin = PlayerDataModule.AllScenePerMinCoin(true) * Config.globalConfig.getInstace().AdvertGoldReward;
                    //加钱
                    SetValueOfPlayerData.Send((int)GameMessageDefine.AddCoinOfPlayerDataMSSC, 0, rewardNumCoin, 0);
                    float timeCount = 0.1f;
                    DOTween.To(() => timeCount, a => timeCount = a, 0.1f, 0.1f).OnComplete(new TweenCallback(delegate
                    {
                        UIMainPage uIMainPage = PageMgr.GetPage <UIMainPage>();
                        uIMainPage.OnMoneyEffect();    //飘钱特效
                    }));
                }
            }

            break;

        case AdTagFM.Add_Tourist_Advert:
            playerLockVisitorNumberAdsVideoCount += 1;
            break;

        case AdTagFM.Add_Ticket_Advert:
            playerLockEntryExpediteAdsVideoCount += 1;
            break;

        case AdTagFM.Add_Visit_Advert:
            playerLockVisitorExpediteAdsVideoCount += 1;
            break;

        case AdTagFM.Add_Offline_Advert:
            playerLockOfflineAdsVideoCount += 1;
            break;

        case AdTagFM.Add_Viptiming_Advert:
            playerFreeItemAdsVideoCount += 1;
            break;

        default:
            break;
        }

        playerWatchAdsVideoCount += 1;



        if (adTagFM == AdTagFM.Add_Double_Advert)
        {
        }
        if (playerWatchAdsVideoCount == Config.globalConfig.getInstace().AdvertRewardNumber)
        {
            var rewardNum = Config.globalConfig.getInstace().AdvertRewardRmbNumber;
            //加钻石
            SetValueOfPlayerData.Send((int)GameMessageDefine.SetDiamondOfPlayerData, rewardNum, 0, 0);
            LogWarp.LogErrorFormat("看广告6次    增加了钻石");
            playerWatchAdsVideoCount = 0;
        }
    }
 private void Test02(int arg1, IntCD arg2)
 {
     LogWarp.LogErrorFormat("BBBBBBBBBBBBBBBBB   {0}    {1}", arg1, arg2.org);
     arg2.Reset();
     arg2.Run();
 }
Beispiel #12
0
        protected bool CalcOffline(bool forceCalc)
        {
            //Debug.LogError("CalcOffline");
            long calcDuation = (DateTime.Now.Ticks - this.calcOffineTick) / 10000000;

            if (calcDuation <= 5 && !forceCalc)
            {
                LogWarp.Log("CalcOffline FALSE calcDuation <= 5 && !forceCalc");
                return(false);
            }

            playerData = GlobalDataManager.GetInstance().playerData;

            if (playerData.playerZoo.isGuide)
            {
                //Logger.LogWarp.LogErrorFormat("playerData.playerZoo.isGuide {0}", playerData.playerZoo.isGuide);
                return(false);
            }

            var buffList = playerData.playerZoo.buffList;
            var buffs    = GetCurrBuffs();

            buffs.Clear();
            buffs.AddRange(buffList);
            double offlineSeconds = playerData.GetOfflineSecond();

            if (offlineSeconds <= 0)
            {
                //Debug.LogError("CalcOffline FALSE offlineTime <=0");
                return(false);
            }

            //if (playerData.playerZoo.buffList == null)
            //{
            //    playerData.playerZoo.buffList = new List<Buff>();
            //}

            removeBuffList.Clear();

            var offlineBuffList = new List <Buff>();

            playerData.playerZoo.offlineBuffList = offlineBuffList;
            for (int i = 0; i < buffList.Count; i++)
            {
                var buff = buffList[i];
                //构建离线buff列表
                if ((offlineSeconds > 0) &&
                    (buff.buffType == BuffType.RatioCoinInComeAdd || buff.buffType == BuffType.RatioCoinInComeMul))
                {
                    LogWarp.LogErrorFormat("构建离线buff列表");
                    //offlineTime += Config.globalConfig.getInstace().MinOfflineSecond;
                    double offlineBuffTime = Math.Min(buff.CD.cd, offlineSeconds);
                    if (offlineBuffTime > 0)
                    {
                        var offlineBuff = new Buff();
                        offlineBuff.Init(buff.buffID, offlineBuffTime);
                        //离线buff不涉及合并规则,因为离线buff来源于buff列表,已经合并过。
                        offlineBuffList.Add(offlineBuff);
                    }
                }
                //正常BUFF扣除离线时间
                buff.CD.cd -= offlineSeconds;
                if (buff.CD.cd <= 0)
                {
                    removeBuffList.Add(i);
                }
            }
            //记录要移除的buff载体
            List <Buff> removeList = new List <Buff>();

            //移除移除剩余时间<=0的buff
            for (int i = 0; i < removeBuffList.Count; i++)
            {
                int removeIdx = removeBuffList[i];
                removeList.Add(buffList[removeIdx]);
            }
            foreach (var item in removeList)
            {
                buffList.Remove(item);
            }

            calcOffineTick = DateTime.Now.Ticks;

            buffs.Clear();
            buffs.AddRange(buffList);

            GlobalDataManager.GetInstance().offlineSeconds = offlineSeconds;
            //Debug.LogError("CalcOffline TRUE");
            return(true);
        }