public void SetFlag(NodeFlag _this, int index, bool b = true, bool forceNotToClient = false) { if (b) { _this.mData.SetFlag(index); if (index == 30) { var bag = _this.mCharacter.mBag.GetBag((int)eBagType.Depot); bag.ForceAddItem(22000, 2, _this.mCharacter, eCreateItemType.HiddenRules); } } else { _this.mData.CleanFlag(index); } if (forceNotToClient) { _this.MarkDbDirty(); } else { _this.MarkDirty(); AddNetDirty(_this, index, b); } }
public void NetDirtyHandle(NodeFlag _this) { var count = _this.mNetDirtyList.Count; if (count < 1) { return; } //if(mCharacter.Proxy==null) return; if (count == 1) { foreach (var i in _this.mNetDirtyList) { _this.mCharacter.Proxy.SyncFlag(i.Key, i.Value ? 1 : 0); } } else { var trueList = new Int32Array(); var falseList = new Int32Array(); foreach (var i in _this.mNetDirtyList) { if (i.Value) { trueList.Items.Add(i.Key); } else { falseList.Items.Add(i.Key); } } _this.mCharacter.Proxy.SyncFlagList(trueList, falseList); } _this.mNetDirtyList.Clear(); }
//根据事件重置标记位 public void ResetByTime(NodeFlag _this, int type, int hour) { switch (type) { case 0: { List <int> tempList; if (NodeFlag.DaysHour.TryGetValue(hour, out tempList)) { foreach (var i in tempList) { Reset(_this, i); } } } break; case 1: { List <int> tempList; if (NodeFlag.WeekHour.TryGetValue(hour, out tempList)) { foreach (var i in tempList) { Reset(_this, i); } } } break; case 2: { List <int> tempList; if (NodeFlag.MonthHour.TryGetValue(hour, out tempList)) { foreach (var i in tempList) { Reset(_this, i); } } } break; } }
private void AddNetDirty(NodeFlag _this, int index, bool b) { _this.mNetDirtyList[index] = b; }
//重置标记位 public void Reset(NodeFlag _this, int nIndex) { _this.mCharacter.SetFlag(nIndex, false); }
//初始化(按数据库配置) public void InitByDB(NodeFlag _this, CharacterController character, DBCharacterLogic dbplayer) { _this.mCharacter = character; _this.mData = new BitFlag(NodeFlag.FlagCount, dbplayer.Flag); }