Exemplo n.º 1
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.accepts           = new IntObjectMap <QuestData>();
     this.completeLines     = new IntIntMap();
     this.completeIDs       = new IntSet();
     this.completeQuestsDic = new IntObjectMap <QuestCompleteData>();
 }
Exemplo n.º 2
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.way = stream.readInt();

        int dicLen = stream.readLen();

        if (this.dic != null)
        {
            this.dic.clear();
            this.dic.ensureCapacity(dicLen);
        }
        else
        {
            this.dic = new IntIntMap(dicLen);
        }

        IntIntMap dicT = this.dic;

        for (int dicI = dicLen - 1; dicI >= 0; --dicI)
        {
            int dicK;
            int dicV;
            dicK = stream.readInt();

            dicV = stream.readInt();

            dicT.put(dicK, dicV);
        }
    }
Exemplo n.º 3
0
 public void onRemoveItemsByServer(IntIntMap dic, int way)
 {
     dic.forEach((k, v) =>
     {
         doRemoveItemByServer(k, v, way);
     });
 }
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        int attributesLen = stream.readLen();

        if (this.attributes != null)
        {
            this.attributes.clear();
            this.attributes.ensureCapacity(attributesLen);
        }
        else
        {
            this.attributes = new IntIntMap(attributesLen);
        }

        IntIntMap attributesT = this.attributes;

        for (int attributesI = attributesLen - 1; attributesI >= 0; --attributesI)
        {
            int attributesK;
            int attributesV;
            attributesK = stream.readInt();

            attributesV = stream.readInt();

            attributesT.put(attributesK, attributesV);
        }
    }
Exemplo n.º 5
0
    public void makeSimpleUnitData(UnitSimpleData re)
    {
        re.instanceID = instanceID;
        re.identity   = (UnitIdentityData)_data.identity.clone();

        if (re.pos == null)
        {
            re.pos = (UnitPosData)_data.pos.clone();
        }
        else
        {
            re.pos.copy(_data.pos);
        }

        if (re.attributes == null)
        {
            re.attributes = new IntIntMap();
        }
        else
        {
            re.attributes.clear();
        }

        if (_data.fight != null)
        {
            IntIntMap dic = _data.fight.attributes;

            foreach (int k in AttributeControl.attribute.simpleUnitList)
            {
                re.attributes.put(k, dic.get(k));
            }
        }
    }
Exemplo n.º 6
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.instanceID = 0;
     this.identity   = null;
     this.pos        = null;
     this.attributes = null;
 }
Exemplo n.º 7
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.modelID = stream.readInt();

        int partsLen = stream.readLen();

        if (this.parts != null)
        {
            this.parts.clear();
            this.parts.ensureCapacity(partsLen);
        }
        else
        {
            this.parts = new IntIntMap(partsLen);
        }

        IntIntMap partsT = this.parts;

        for (int partsI = partsLen - 1; partsI >= 0; --partsI)
        {
            int partsK;
            int partsV;
            partsK = stream.readInt();

            partsV = stream.readInt();

            partsT.put(partsK, partsV);
        }
    }
Exemplo n.º 8
0
    /** 一秒十次 */
    public void onPiece(int delay)
    {
        IntObjectMap <CDData> cds;

        if ((cds = _cds).isEmpty())
        {
            return;
        }

        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        foreach (CDData data in _cds)
        {
            if ((data.timePass += delay) >= data.timeMax)
            {
                cds.remove(data.id);

                //移除对应组CD
                foreach (int gv in data.config.groups)
                {
                    groupCDCount.addValue(gv, -1);

                    if (groupMaxCDs.get(gv) == data)
                    {
                        groupMaxCDs.remove(gv);

                        parent.onEndGroupCD(gv);
                    }
                }
            }
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.currentAttributes = null;
     this.buffs             = null;
     this.cds       = null;
     this.cacheTime = 0L;
 }
Exemplo n.º 10
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.instanceID = 0;
        this.attributes = null;
    }
Exemplo n.º 11
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.way = 0;
        this.dic = null;
    }
Exemplo n.º 12
0
    /** 初始化碰撞系列的子弹所需 */
    protected void initBulletForHit()
    {
        //自身打击跳过
        if (!BaseC.constlist.bulletCast_isSelfHit(_levelConfig.castType))
        {
            calculateSpeedByAngle();
        }

        if (!_unit.isSelfDriveAttackHapen())
        {
            return;
        }

        _attackConfig = AttackConfig.get(_config.attackID);

        _hitTimePass = 0;
        _hitDelay    = _config.hitDelay;

        if (_hitTargetNums == null)
        {
            _hitTargetNums = new IntIntMap();
        }

        if (_tempUnitList == null)
        {
            _tempUnitList = new SList <Unit>();
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// 读完表后处理
    /// </summary>
    protected override void afterReadConfig()
    {
        base.afterReadConfig();

        showPartsT      = ObjectUtils.parseIntIntMapByDIntArr(showParts);
        defaultHitRectT = SRect.createByConfig(defaultHitRect);
    }
Exemplo n.º 14
0
    /** 服务器添加物品 */
    public void onAddItemsByServer(IntIntMap autoUseItems, IntObjectMap <ItemData> dic, int way)
    {
        bool need = CallWayConfig.get(way).needAddItemNotice;

        if (need)
        {
            _tempAddItems.clear();

            if (autoUseItems != null)
            {
                autoUseItems.forEach((k, v) =>
                {
                    _tempAddItems.add(GameC.player.bag.createItem(k, v));
                });
            }
        }

        if (dic != null)
        {
            foreach (var kv in dic.entrySet())
            {
                doAddItemByServer(kv.key, kv.value, way);
            }
        }

        onChanged();

        if (CallWayConfig.get(way).needAddItemNotice)
        {
            //TODO:合并因为到达单个物品上限的拆分问题
            onAddItemNotice(_tempAddItems, way);
            _tempAddItems.clear();
        }
    }
Exemplo n.º 15
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.booleanDic = new IntBooleanMap();
     this.intDic     = new IntIntMap();
     this.longDic    = new IntLongMap();
     this.stringDic  = new SMap <string, string>();
 }
Exemplo n.º 16
0
    /** 每秒调用 */
    public override void onSecond(int delay)
    {
        IntSet    needSendSet = _needSendSet;
        IntIntMap dic         = _lockDic;

        int fv = dic.getFreeValue();

        int[] keys   = dic.getKeys();
        int[] values = dic.getValues();
        int   key;

        for (int i = keys.Length - 1; i >= 0; --i)
        {
            if ((key = keys[i]) != fv)
            {
                if (values[i] > 0)
                {
                    if (--values[i] == 0)
                    {
                        if (needSendSet.contains(key))
                        {
                            needSendSet.remove(key);

                            //是当前页才发送
                            if (_currentPage == key)
                            {
                                values[i] = Global.pageToolShowCD;
                                sendGet(key);
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 17
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.booleanDic = null;
     this.intDic     = null;
     this.longDic    = null;
     this.stringDic  = null;
 }
Exemplo n.º 18
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        int itemPriceDicLen = stream.readLen();

        if (this.itemPriceDic != null)
        {
            this.itemPriceDic.clear();
            this.itemPriceDic.ensureCapacity(itemPriceDicLen);
        }
        else
        {
            this.itemPriceDic = new IntIntMap(itemPriceDicLen);
        }

        IntIntMap itemPriceDicT = this.itemPriceDic;

        for (int itemPriceDicI = itemPriceDicLen - 1; itemPriceDicI >= 0; --itemPriceDicI)
        {
            int itemPriceDicK;
            int itemPriceDicV;
            itemPriceDicK = stream.readInt();

            itemPriceDicV = stream.readInt();

            itemPriceDicT.put(itemPriceDicK, itemPriceDicV);
        }

        stream.endReadObj();
    }
Exemplo n.º 19
0
    /** 设置数据 */
    public void setData(IntIntMap values)
    {
        _attributesDataDic = values;

        if (values != null && !values.isEmpty())
        {
            int[]  attributes      = _attributes;
            int[]  lastDispatches  = _lastDispatch;
            bool[] needDispatchSet = _info.needDispatchSet;

            values.forEach((k, v) =>
            {
                attributes[k] = v;

                int currentID;
                if ((currentID = _info.maxToCurrentMap[k]) > 0)
                {
                    _currentMaxCache[_info.currentToIndex[currentID]] = v;
                }

                if (needDispatchSet[k])
                {
                    lastDispatches[k] = v;
                }
            });

            _dispatchDirty = false;

            if (CommonSetting.isClientDriveLogic)
            {
                countNeedIncrease();
            }
        }
    }
Exemplo n.º 20
0
    public void setData(IntObjectMap <CDData> cds)
    {
        _cds = cds;

        if (cds != null && !cds.isEmpty())
        {
            IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
            IntIntMap             groupCDCount = _groupCDCount;

            CDData[] values = cds.getValues();
            CDData   data;

            for (int i = values.Length - 1; i >= 0; --i)
            {
                if ((data = values[i]) != null)
                {
                    int lastTime = data.getLastTime();

                    CDConfig config = data.config = CDConfig.get(data.id);

                    foreach (int v in config.groups)
                    {
                        groupCDCount.addValue(v, 1);

                        CDData oldMax = groupMaxCDs.get(v);

                        if (oldMax == null || oldMax.getLastTime() < lastTime)
                        {
                            groupMaxCDs.put(v, data);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 21
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.modelID = 0;
        this.parts   = null;
    }
Exemplo n.º 22
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.clientTaskInstanceIDIndex = 0;
     this.accepts           = null;
     this.completeLines     = null;
     this.completeIDs       = null;
     this.completeQuestsDic = null;
 }
Exemplo n.º 23
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.way          = 0;
        this.autoUseItems = null;
        this.items        = null;
    }
Exemplo n.º 24
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.status     = null;
     this.attributes = null;
     this.skills     = null;
     this.buffs      = null;
     this.cds        = null;
 }
Exemplo n.º 25
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.status     = new IntBooleanMap();
     this.attributes = new IntIntMap();
     this.skills     = new IntObjectMap <SkillData>();
     this.buffs      = new IntObjectMap <BuffData>();
     this.cds        = new IntObjectMap <CDData>();
 }
Exemplo n.º 26
0
    /** 造型部件改变 */
    public virtual void onAvatarPartChange(IntIntMap dic)
    {
        Unit unit;

        if ((unit = _unit) != null)
        {
            unit.avatar.onAvatarPartChange(dic);
        }
    }
Exemplo n.º 27
0
    /** 添加CD组 */
    public void reAddCDs(IntObjectMap <CDData> dic, int dTime)
    {
        if (dic.isEmpty())
        {
            return;
        }

        IntObjectMap <CDData> cds = _cds;

        if (!cds.isEmpty())
        {
            Ctrl.throwError("这时cd组不应该有值");
        }

        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        CDData[] values = dic.getValues();
        CDData   v;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                v.config    = CDConfig.get(v.id);
                v.timePass += dTime;

                //依然有效
                if (v.timePass < v.timeMax)
                {
                    cds.put(v.id, v);

                    foreach (int gv in v.config.groups)
                    {
                        groupCDCount.addValue(gv, 1);

                        CDData oldMax = groupMaxCDs.get(gv);

                        if (oldMax == null || oldMax.getLastTime() < v.getLastTime())
                        {
                            groupMaxCDs.put(gv, v);
                        }

                        //新的
                        if (oldMax == null)
                        {
                            parent.onStartGroupCD(gv);
                        }
                    }
                }
            }
        }

        _parent.onCDChange();
    }
Exemplo n.º 28
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is RoleAttributeData))
        {
            return;
        }

        RoleAttributeData mData = (RoleAttributeData)data;

        this.attributes = mData.attributes;
    }
Exemplo n.º 29
0
    /** 缓存到当前数据(见BuffKeepType) */
    public void saveCache(MUnitCacheData data, int keepType)
    {
        data.cacheTime = getTimeMillis();

        //当前属性
        IntIntMap currentAttributes = data.currentAttributes;

        currentAttributes.clear();

        int[] currentList = AttributeControl.attribute.currentList;

        for (int i = currentList.Length - 1; i >= 0; --i)
        {
            currentAttributes.put(currentList[i], attribute.getAttribute(currentList[i]));
        }

        //buff
        IntObjectMap <BuffData> buffs = data.buffs;

        buffs.clear();

        BuffData[] values = buff.getBuffDatas().getValues();
        BuffData   v;

        for (int i = values.Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                if (v.config.keepType == keepType)
                {
                    buffs.put(v.instanceID, (BuffData)v.clone());                   //clone
                }
            }
        }

        //cd
        IntObjectMap <CDData> cds = data.cds;

        cds.clear();

        CDData[] cdValues = cd.getCDs().getValues();
        CDData   cdV;

        for (int i = cdValues.Length - 1; i >= 0; --i)
        {
            if ((cdV = cdValues[i]) != null)
            {
                if (CDConfig.get(cdV.id).keepType == keepType)
                {
                    cds.put(cdV.id, (CDData)cdV.clone());                   //clone
                }
            }
        }
    }
Exemplo n.º 30
0
    /** 开始服务器CD组 */
    public void startCDsByServer(SList <CDData> list)
    {
        IntObjectMap <CDData> cds          = _cds;
        IntObjectMap <CDData> groupMaxCDs  = _groupMaxCDs;
        IntIntMap             groupCDCount = _groupCDCount;
        UnitFightDataLogic    parent       = _parent;

        CDData   oldData;
        CDData   data;
        CDConfig config;

        foreach (CDData v in list)
        {
            config = CDConfig.get(v.id);

            if ((oldData = cds.get(v.id)) == null)
            {
                data        = v;
                data.config = config;

                cds.put(data.id, data);
            }
            else
            {
                data          = oldData;
                data.timePass = v.timePass;
                data.timeMax  = v.timeMax;
            }

            foreach (int gv in config.groups)
            {
                //计数加1
                if (oldData == null)
                {
                    groupCDCount.addValue(gv, 1);
                }

                CDData oldMax = groupMaxCDs.get(gv);

                if (oldMax == null || oldMax.getLastTime() < data.timeMax)
                {
                    groupMaxCDs.put(gv, data);
                }

                //新的
                if (oldMax == null)
                {
                    parent.onStartGroupCD(gv);
                }
            }
        }

        _parent.onCDChange();
    }