/** 服务器添加物品 */ 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(); } }
public void onRemoveItemsByServer(IntIntMap dic, int way) { dic.forEach((k, v) => { doRemoveItemByServer(k, v, way); }); }
/** 删除造型更换 */ public void removeFacade(int facadeID) { if (_changeFacadeDic.addValue(facadeID, -1) == 0) { if (facadeID == _changeFacadeID) { int[] cArgs = { -1, -1 }; _changeFacadeDic.forEach((k, v) => { if (v > 0) { int priority; if ((priority = FacadeConfig.get(k).proirity) > cArgs[0]) { cArgs[0] = priority; cArgs[1] = k; } } }); setFacade(cArgs[1]); } } }
/** 设置数据 */ 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(); } } }
/// <summary> /// 执行 /// </summary> protected override void execute() { attributes.forEach((k, v) => { Ctrl.print("AA", k, v); }); role.attribute.getAttribute().setAttributesByServer(attributes); }
private void countAvatar() { IntIntMap dataParts = _dataParts; if (_changeFacadeID != -1) { FacadeConfig config = FacadeConfig.get(_changeFacadeID); _data.modelID = config.modelID; dataParts.forEach((k, v) => { setPart(k, -1); }); foreach (DIntData v in config.parts) { setPart(v.key, v.value); } } else { _data.modelID = _defaultModelID; dataParts.forEach((k, v) => { setPart(k, -1); }); int[] normalParts; int value; for (int i = (normalParts = _normalParts).Length - 1; i >= 0; --i) { if ((value = normalParts[i]) > 0) { setPart(i, value); } } } }
/** 服务器设置部件 */ public void setAvatarPartByServer(IntIntMap values) { int[] lastDispatches = _lastDispatches; int[] nowParts = _nowParts; values.forEach((k, v) => { lastDispatches[k] = nowParts[k] = v; }); _parent.onAvatarPartChange(values); }
/// <summary> /// 执行 /// </summary> protected override void execute() { UnitSimpleData data = scene.getBindVisionUnit(instanceID); if (data != null) { attributes.forEach((k, v) => { data.attributes.put(k, v); }); scene.inout.simpleUnitAttributeChanged(data); } }
/** 服务器设置部件 */ public void setAvatarByServer(int modelID, IntIntMap values) { _lastDispatchModelID = _data.modelID = modelID; int[] lastDispatches = _lastDispatches; int[] nowParts = _nowParts; values.forEach((k, v) => { lastDispatches[k] = nowParts[k] = v; }); _parent.onAvatarChange(modelID); }
/** 服务器设置属性 */ public void setAttributesByServer(IntIntMap dic) { int[] attributes = _attributes; bool[] needDispatchSet = _info.needDispatchSet; dic.forEach((k, v) => { attributes[k] = v; if (needDispatchSet[k]) { _dispatchDirty = true; } }); //立刻计算 if (_dispatchDirty) { countDispatchAttributes(); } }