Exemplo n.º 1
0
        //检查并显示一个提示条
        private bool CheckAndShowMsg(int entryId, int itemId, int bagIdx)
        {
            var _args = PlayerDataManager.Instance.GetGainItemHintEntryArgs(itemId, bagIdx);

            if (_args == null)
            {
                return(false);
            }

            m_DataModel.UseMask = BitFlag.IntSetFlag(m_DataModel.UseMask, entryId);

            var _entry = m_DataModel.Entrys[entryId];

            _entry.BagItemData   = _args.ItemData;
            _entry.Count         = _args.Count;
            _entry.FightValueOld = _args.FightValueOld;
            _entry.Index         = _args.OldEquipIdx;
            _entry.FightValueAdd = _entry.BagItemData.FightValue - _entry.FightValueOld;

            var quality = Table.GetItemBase(_entry.BagItemData.ItemId).Quality;

            m_DataModel.IsShowTimes[entryId] = false;
            if (quality <= 3 && _entry.BagItemData.BagId == 0)
            {
                m_DataModel.IsShowTimes[entryId]    = true;
                CountdownTime[entryId]              = 9f;
                m_DataModel.CountdownTimes[entryId] = "(" + (int)CountdownTime[entryId] + GameUtils.GetDictionaryText(1045) + ")";
            }
            return(true);
        }
Exemplo n.º 2
0
    //卸下装备中的技能
    public void UnEquipSkill(IEvent ievent)
    {
        var ee        = ievent as UIEvent_SkillFrame_UnEquipSkill;
        var skillitem = new SkillItemDataModel();

        skillitem.SkillId    = -1;
        mEquipSkillDirtyMark = BitFlag.IntSetFlag(mEquipSkillDirtyMark, ee.Index);
        SkillDataModel.EquipSkills[ee.Index] = skillitem;
        skillChanged = true;

        SyncSkillEquipData(null);
    }
Exemplo n.º 3
0
    //拖拽技能到技能bar
    public void OnSkillEquip(IEvent ievent)
    {
        var ee        = ievent as UIEvent_SkillFrame_EquipSkill;
        var nIndex    = ee.Index;
        var skillId   = ee.SkillId;
        var skillData = SkillDataModel;

        SkillItemDataModel equipSkill;

        if (!PlayerDataManager.Instance.mAllSkills.TryGetValue(skillId, out equipSkill))
        {
            Logger.Error("player dont have this skill -----skillID = {0}--", skillId);
            return;
        }

        //如果当前槽位冷却中,新加入技能重新冷却
        var bNewSkill   = true;
        var lastSkillCD = (Math.Abs(skillData.EquipSkills[nIndex].CoolDownTime) > 0.0001f);

        //如果技能在别的槽位,把原来的槽位置空
        var equipindex = skillData.EquipSkills.IndexOf(equipSkill);

        if (equipindex != -1)
        {
            var nullSkill = new SkillItemDataModel();
            nullSkill.SkillId = -1;
            skillData.EquipSkills[equipindex] = nullSkill;
            bNewSkill = false;
        }

        if (bNewSkill && lastSkillCD)
        {
            mEquipSkillDirtyMark = BitFlag.IntSetFlag(mEquipSkillDirtyMark, nIndex);
        }

        skillData.EquipSkills[nIndex] = equipSkill;
        skillChanged = true;


        if (ee.BSyncToServer)
        {
            SyncSkillEquipData(null);
        }
        else
        {
            PlayerDataManager.Instance.RefrehEquipPriority();
        }
    }
Exemplo n.º 4
0
    //检查并显示一个提示条
    public bool SetupEntry(int entryId, int itemId, int bagIdx)
    {
        var args = PlayerDataManager.Instance.GetGainItemHintEntryArgs(itemId, bagIdx);

        if (args == null)
        {
            return(false);
        }

        DataModel.UseMask = BitFlag.IntSetFlag(DataModel.UseMask, entryId);

        var entry = DataModel.Entrys[entryId];

        entry.BagItemData   = args.ItemData;
        entry.Count         = args.Count;
        entry.FightValueOld = args.FightValueOld;
        entry.Index         = args.OldEquipIdx;
        entry.FightValueAdd = entry.BagItemData.FightValue - entry.FightValueOld;
        return(true);
    }
Exemplo n.º 5
0
 //关闭一个提示条
 private void ShutPanel(int index)
 {
     ResetTimer();
     if (m_Caches.Count > 0)
     {
         for (int i = 0, imax = m_Caches.Count; i < imax; i++)
         {
             var _cache = m_Caches[i];
             if (CheckItemIdEntry(_cache.ItemId) || CheckAndShowMsg(index, _cache.ItemId, _cache.BagIdx))
             {
                 m_Caches.RemoveRange(0, i + 1);
                 return;
             }
         }
         m_Caches.Clear();
     }
     //缓存中没有符合条件的,则关闭该提示条
     m_DataModel.UseMask = BitFlag.IntSetFlag(m_DataModel.UseMask, index, false);
     if (m_DataModel.UseMask == 0)
     {
         ShutUI();
     }
 }
Exemplo n.º 6
0
 //关闭一个提示条
 public void ClosePanel(int index)
 {
     ResetTimer();
     if (Caches.Count > 0)
     {
         for (int i = 0, imax = Caches.Count; i < imax; i++)
         {
             var cache = Caches[i];
             if (CheckEntry(cache.ItemId) || SetupEntry(index, cache.ItemId, cache.BagIdx))
             {
                 Caches.RemoveRange(0, i + 1);
                 return;
             }
         }
         Caches.Clear();
     }
     //缓存中没有符合条件的,则关闭该提示条
     DataModel.UseMask = BitFlag.IntSetFlag(DataModel.UseMask, index, false);
     if (DataModel.UseMask == 0)
     {
         CloseUI();
     }
 }
Exemplo n.º 7
0
        private void EnterPhase()
        {
            Log(Logger, "EnterPhase:LogidId = {0}", mFubenLogicRecord.Id);

            //把该阶段的完成条件组织一下
            mPhaseRequirementDic.Clear();
            mPhaseRequirements.Clear();
            for (int i = 0, imax = FubenLogicRecord.SwitchState.Length; i < imax; ++i)
            {
                var type    = (EnterPhaseRequireType)FubenLogicRecord.SwitchState[i];
                var param1  = FubenLogicRecord.SwitchParam1[i];
                var param2  = FubenLogicRecord.SwitchParam2[i];
                var infoIdx = FubenLogicRecord.SwitchInfoPa[i];
                if ((int)type == -1)
                {
                    break;
                }

                var realType = type == EnterPhaseRequireType.KillMonsterGroup ? EnterPhaseRequireType.KillMonster : type;
                Dictionary <int, EnterPhaseRequireStruct> requireDic;
                if (!mPhaseRequirementDic.TryGetValue(realType, out requireDic))
                {
                    requireDic = new Dictionary <int, EnterPhaseRequireStruct>();
                    mPhaseRequirementDic.Add(realType, requireDic);
                }
                var require = new EnterPhaseRequireStruct(param1, param2, infoIdx);
                mPhaseRequirements.Add(require);
                switch (type)
                {
                case EnterPhaseRequireType.KillMonsterGroup:
                {
                    var tbSkillUpgrading = Table.GetSkillUpgrading(param1);
                    foreach (var monsterId in tbSkillUpgrading.Values)
                    {
                        requireDic.Add(monsterId, require);
                    }
                }
                break;

                default:
                {
                    requireDic.Add(param1, require);
                }
                break;
                }
            }

            //执行进入该阶段的操作
            for (int i = 0, imax = FubenLogicRecord.EnterStage.Length; i < imax; ++i)
            {
                var type   = FubenLogicRecord.EnterStage[i];
                var param1 = FubenLogicRecord.EnterParam1[i];
                var param2 = FubenLogicRecord.EnterParam2[i];
                if (type == -1)
                {
                    break;
                }
                switch ((EnterPhaseOperateType)type)
                {
                case EnterPhaseOperateType.CreateMonster:
                {
                    var tbSkillUpgrading = Table.GetSkillUpgrading(param1);
                    foreach (var sceneNpcId in tbSkillUpgrading.Values)
                    {
                        CreateMonsters(sceneNpcId, param2);
                    }
                }
                break;

                case EnterPhaseOperateType.IntermittentCreateMonster:
                {
                    DoIntermittentCreateMonster(param1, param2);
                }
                break;

                case EnterPhaseOperateType.KillMonster:
                {
                    if (param2 > 0)
                    {
                        CreateTimer(DateTime.Now.AddMilliseconds(param2), () => { RemoveObj(param1); });
                    }
                    else
                    {
                        RemoveObj(param1);
                    }
                }
                break;

                case EnterPhaseOperateType.OpenGate:
                {
                    var tbArea = Table.GetTriggerArea(param1);
                    if (tbArea == null)
                    {
                        break;
                    }
                    BroadcastSceneAction(tbArea);
                    if (tbArea.OffLineTrigger != -1)
                    {
                        Exdata = BitFlag.IntSetFlag(Exdata, tbArea.OffLineTrigger);
                    }
                }
                break;

                case EnterPhaseOperateType.NotifyCountDown:
                {
                    PushActionToAllPlayer(
                        player =>
                        {
                            player.Proxy.NotifyCountdown((ulong)DateTime.Now.AddSeconds(param1).ToBinary(), param2);
                        });
                }
                break;

                case EnterPhaseOperateType.NotifyBattleReminder:
                {
//通知客户端显示相关信息
                    PushActionToAllPlayer(
                        player => { player.Proxy.NotifyBattleReminder(19, Utils.WrapDictionaryId(param1), param2); });
                }
                break;

                case EnterPhaseOperateType.RemoveBuff:
                {
                    foreach (
                        var character in mObjDict.Values.Where(obj => obj.TypeId == param1).Cast <ObjCharacter>())
                    {
                        var datas = character.BuffList.GetBuffById(param2);
                        foreach (var data in datas)
                        {
                            MissBuff.DoEffect(this, character, data);
                            character.DeleteBuff(data, eCleanBuffType.EffectOver);
                        }
                    }
                }
                break;

                case EnterPhaseOperateType.WaitTime:
                {
                    SceneServerControl.Timer.CreateTrigger(DateTime.Now.AddMilliseconds(param1),
                                                           () => { AccomplishPhaseRequire(EnterPhaseRequireType.Wait, param1); });
                }
                break;

                case EnterPhaseOperateType.NotifyStartWarning:
                {
                    PushActionToAllPlayer(
                        player =>
                        {
                            player.Proxy.NotifyStartWarning((ulong)DateTime.Now.AddSeconds(param1).ToBinary());
                        });
                }
                break;

                case EnterPhaseOperateType.SwitchState:
                {
                    var now         = DateTime.Now;
                    var targetState = (eDungeonState)param1;
                    switch (targetState)
                    {
                    case eDungeonState.Start:
                    {
                        var startTime = now.AddSeconds(param2);
                        StartTimer(eDungeonTimerType.WaitStart, startTime, TimeOverStart);
                        StartTimer(eDungeonTimerType.WaitEnd,
                                   startTime.AddMinutes(mFubenRecord.TimeLimitMinutes), TimeOverEnd);
                    }
                    break;

                    case eDungeonState.WillClose:
                        break;

                    case eDungeonState.Closing:
                    {
                        var result = new FubenResult();
                        result.CompleteType = (int)eDungeonCompleteType.Success;
                        CompleteToAll(result, param2);

                        SendFubenInfo();
                    }
                    break;

                    default:
                    {
                        Debug.Assert(false, "Type Error:" + targetState.ToString());
                    }
                    break;
                    }
                }
                break;
                }
            }

            //准备一下要发给客户端的数据结构
            FubenLogicRecord oldRecord = null;

            if (mFubenInfoMsg.LogicId != -1)
            {
                oldRecord = Table.GetFubenLogic(mFubenInfoMsg.LogicId);
            }
            var units = mFubenInfoMsg.Units;

            mFubenInfoMsg.LogicId = FubenLogicRecord.Id;
            mIsFubenInfoDirty     = true;
            for (int i = 0, imax = FubenLogicRecord.FubenInfo.Length; i < imax; i++)
            {
                var type = (eFubenInfoType)FubenLogicRecord.FubenInfo[i];
                if ((int)type == -1)
                {
                    units.RemoveRange(i, units.Count - i);
                    break;
                }

                var infoValue = 0;
                if (type == eFubenInfoType.Percent)
                {
                    infoValue = 100;
                }
                if (i < units.Count)
                {
                    var unit = units[i];
                    if (FubenLogicRecord.IsClearCount == 0 && oldRecord != null && (int)type == oldRecord.FubenInfo[i])
                    {
//如果上一阶段的type和这一阶段的type一样,且IsClearCount == 0,不清计数
                    }
                    else
                    {
//否则,清计数
                        if (unit.Params.Count > 0)
                        {
                            unit.Params[0] = infoValue;
                        }
                    }
                }
                else
                {
                    var unit = new FubenInfoUnit();
                    unit.Index = i;
                    unit.Params.Add(infoValue);
                    units.Add(unit);

                    switch (type)
                    {
                    case eFubenInfoType.Percent:
                    {
                        var pars = unit.Params;
                        if (pars.Count < 2)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.StrongpointInfo:
                    {
                        var pars = unit.Params;
                        for (var j = 0; j < 3; ++j)
                        {
                            if (j < pars.Count)
                            {
                                pars[j] = -1;
                            }
                            else
                            {
                                pars.Add(-1);
                            }
                        }
                    }
                    break;

                    case eFubenInfoType.ShowDictionary2:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 2; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.ShowDictionary3:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 3; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.AllianceWarInfo:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 3; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.AllianceWarState:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 2; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;
                    }
                }
            }
        }
Exemplo n.º 8
0
    public void Close()
    {
        var dic = new Dictionary <int, int>();

        if (Math.Abs(BackUpModel.AutoCombat.Hp - DataModel.AutoCombat.Hp) > 0.01)
        {
            dic.Add(59, (int)(DataModel.AutoCombat.Hp * 100));
        }
        if (Math.Abs(BackUpModel.AutoCombat.Mp - DataModel.AutoCombat.Mp) > 0.01)
        {
            dic.Add(60, (int)(DataModel.AutoCombat.Mp * 100));
        }

        BackUpModel.AutoCombat.Mp = DataModel.AutoCombat.Mp;

        var chgPick = false;
        var flag61  = 0;

        for (var i = 0; i < 8; i++)
        {
            if (BackUpModel.AutoCombat.Pickups[i] != DataModel.AutoCombat.Pickups[i])
            {
                chgPick = true;
                break;
            }
        }

        flag61 = 0;

        for (var i = 0; i < 8; i++)
        {
            if (DataModel.AutoCombat.Pickups[i])
            {
                flag61 = BitFlag.IntSetFlag(flag61, i);
            }
        }


        var chgRang = false;

        for (var i = 0; i < 3; i++)
        {
            if (BackUpModel.AutoCombat.Ranges[i] != DataModel.AutoCombat.Ranges[i])
            {
                chgRang = true;
                break;
            }
        }

        for (var i = 0; i < 3; i++)
        {
            if (DataModel.AutoCombat.Ranges[i])
            {
                if (i == 1)
                {
                    flag61 = BitFlag.IntSetFlag(flag61, 8);
                }
                else if (i == 2)
                {
                    flag61 = BitFlag.IntSetFlag(flag61, 9);
                }
            }
        }

        if (chgPick || chgRang)
        {
            dic.Add(61, flag61);
        }

        if (dic.Count > 0)
        {
            PlayerDataManager.Instance.SetExDataNet(dic);
        }

        var tureArray  = new Int32Array();
        var falseArray = new Int32Array();

        for (var i = 0; i < 4; i++)
        {
            if (DataModel.SystemSetting.Other[i] != BackUpModel.SystemSetting.Other[i])
            {
                if (DataModel.SystemSetting.Other[i])
                {
                    tureArray.Items.Add(480 + i);
                }
                else
                {
                    falseArray.Items.Add(480 + i);
                }
            }
        }


        //后添加的两个设置
        //又增加一个屏幕节能开关
        if (DataModel.SystemSetting.Other[4] != BackUpModel.SystemSetting.Other[4])
        {
            if (DataModel.SystemSetting.Other[4])
            {
                tureArray.Items.Add(488);
            }
            else
            {
                falseArray.Items.Add(488);
            }
        }

        if (DataModel.SystemSetting.Other[5] != BackUpModel.SystemSetting.Other[5])
        {
            if (DataModel.SystemSetting.Other[5])
            {
                tureArray.Items.Add(489);
            }
            else
            {
                falseArray.Items.Add(489);
            }
        }

        if (DataModel.SystemSetting.Other[6] != BackUpModel.SystemSetting.Other[6])
        {
            if (DataModel.SystemSetting.Other[6])
            {
                tureArray.Items.Add(490);
            }
            else
            {
                falseArray.Items.Add(490);
            }
        }


        if (tureArray.Items.Count > 0 || falseArray.Items.Count > 0)
        {
            PlayerDataManager.Instance.SetFlagNet(tureArray, falseArray);
        }
    }