public async Task AddQuery(SList list) { if (list == null) { return; } if (list.Fields?.Count == 0) { try { StatusNotification.NotifyWithProgress("Prepairing list: " + list.Title); await list.Web.Client.FillListFields(list); StatusNotification.Notify("List ready"); } catch (Exception) { StatusNotification.Notify("Prepairing list failed"); return; } } this.SelectedIndex = this.Items.Add( new ClosableTabItem { HeaderText = list.Title, Content = new QueryTab(list) { Margin = new Thickness(4) } }); CommandManager.InvalidateRequerySuggested(); }
public override void sendCUnitAttack(int id, int level, SkillTargetData tData, SList <Unit> targets, bool isBulletFirstHit) { if (!_g35) { _m35 = instance.Type.GetMethod("sendCUnitAttack", 5); _g35 = true; } if (_m35 != null && !_b35) { _b35 = true; _p5[0] = id; _p5[1] = level; _p5[2] = tData; _p5[3] = targets; _p5[4] = isBulletFirstHit; appdomain.Invoke(_m35, instance, _p5); _p5[0] = null; _p5[1] = null; _p5[2] = null; _p5[3] = null; _p5[4] = null; _b35 = false; } else { base.sendCUnitAttack(id, level, tData, targets, isBulletFirstHit); } }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { this.instanceID = stream.readInt(); int itemsLen = stream.readLen(); if (this.items != null) { this.items.clear(); this.items.ensureCapacity(itemsLen); } else { this.items = new SList <ItemData>(); } SList <ItemData> itemsT = this.items; for (int itemsI = itemsLen - 1; itemsI >= 0; --itemsI) { ItemData itemsV; itemsV = (ItemData)stream.readDataSimpleNotNull(); itemsT.add(itemsV); } this.removeTime = stream.readLong(); }
public void init() { _musicLoadTool = new LoadTool(onLoadMusic); _uiSoundLoadTool = new LoadTool(onLoadUISound); _soundGameObjectPool = new ObjectPool <AudioSource>(createSoundSource); _music = createAudioSource("musicObj", _musicVolume, true); _uiSound = createAudioSource("uiSoundObj", _soundVolume, false); _soundList = new SList <AudioSource>(); _tickIndex = TimeDriver.instance.setInterval(onTick, 100); if (GameC.save.hasInt(LocalSaveType.MusicVolume)) { _musicVolume = GameC.save.getInt(LocalSaveType.MusicVolume) / 1000.0f; } if (GameC.save.hasInt(LocalSaveType.SoundVolume)) { _soundVolume = GameC.save.getInt(LocalSaveType.SoundVolume) / 1000.0f; } if (GameC.save.hasBool(LocalSaveType.MusicSwitch)) { _musicSwitch = GameC.save.getBool(LocalSaveType.MusicSwitch); } if (GameC.save.hasBool(LocalSaveType.SoundSwitch)) { _soundSwitch = GameC.save.getBool(LocalSaveType.SoundSwitch); } }
//shield /** 护盾吸收伤害 */ public void onShieldDamage(int type, int value) { SList <DIntData> list = _shieldBuffDic.get(type); if (list != null) { while (!list.isEmpty()) { DIntData v = list.get(0); if (value < v.value) { v.value -= value; break; } else { value -= v.value; v.value = 0; //盾爆了就删除buff removeBuffByInstanceID(v.key); } } } }
/// <summary> /// 回池 /// </summary> protected override void toRelease(DataPool pool) { base.toRelease(pool); this.items = null; this.gridNum = 0; }
public ArrayList GetPhoneBooks() { ArrayList ebooks = new ArrayList(); SourceList slist = new SourceList("/apps/evolution/addressbook/sources"); if (slist != null) { SList group_list = slist.Groups; //Console.WriteLine ("Group count: {0}", group_list.Count); foreach (SourceGroup group in group_list) { //Only get phone books on this machine. if (group.Name == "On This Computer") { SList src_list = group.Sources; foreach (Evolution.Source src in src_list) { ebooks.Add(src.Name); } } } } return(ebooks); }
/// <summary> /// 添加奖励提示 /// </summary> public virtual void onAddReward(int way, int rewarID, int num, SList <ItemData> randomItemDatas) { RewardShowData data = new RewardShowData(); data.config = RewardConfig.get(rewarID); if (randomItemDatas == null) { randomItemDatas = new SList <ItemData>(); } data.items = randomItemDatas; foreach (DIntData v in data.config.items) { data.items.add(createItem(v.key, v.value * num)); } data.currency = new IntIntMap(); foreach (var v in data.config.currency) { data.currency.addValue(v.key, v.value * num); } me.dispatch(GameEventType.AddReward, data); }
public override void onAddReward(int way, int rewarID, int num, SList <ItemData> randomItemDatas) { if (!_g47) { _m47 = instance.Type.GetMethod("onAddReward", 4); _g47 = true; } if (_m47 != null && !_b47) { _b47 = true; _p4[0] = way; _p4[1] = rewarID; _p4[2] = num; _p4[3] = randomItemDatas; appdomain.Invoke(_m47, instance, _p4); _p4[0] = null; _p4[1] = null; _p4[2] = null; _p4[3] = null; _b47 = false; } else { base.onAddReward(way, rewarID, num, randomItemDatas); } }
/** 刷帧 */ public virtual void onFrame(int delay) { if (!enabled) { return; } SList <SceneObjectLogicBase> logics = _logics; SceneObjectLogicBase logic; for (int i = 0, len = logics.Count; i < len; ++i) { if (enabled) { if ((logic = logics[i]).enabled) { logic.onFrame(delay); } } } if (_needRemove) { _needRemove = false; removeAbs(); } }
/// <summary> /// Initializes the collection for a given type of search algorithm /// </summary> /// <param name="searchType"></param> public SearchCollection(SearchType searchType) : base() { SearchType = searchType; Queue = new Queue <ISearchState>(); Stack = new Stack <ISearchState>(); List = new SList <ISearchState>(); }
public async Task FillContentTypes(SList list, bool fillAlsoWeb = true) { await Task.Factory.StartNew(() => { System.Threading.Thread.Sleep(2000); list.ContentTypes = new List <ContentType> { new ContentType { Id = "0x01231", Name = "Folder" }, new ContentType { Id = "0x01232", Name = "Item" }, }; list.Web.ContentTypes = new List <ContentType> { new ContentType { Id = "0x0123", Name = "Folder" }, new ContentType { Id = "0x0124", Name = "Item 1" }, new ContentType { Id = "0x0125", Name = "Item 2" }, new ContentType { Id = "0x0126", Name = "Item 3" }, }; }); }
public static void makeUITextureImport() { SList <string> files = FileUtils.getDeepFileMutipleList(ShineToolGlobal.assetSourcePath + "/uiTexture", "png", "jpg", "jpeg", "tga"); foreach (string path in files) { string assetUsePath = FileUtils.getAssetUsePath(path); TextureImporter texture = AssetImporter.GetAtPath(assetUsePath) as TextureImporter; if (texture != null && texture.textureType != TextureImporterType.Sprite) { Ctrl.print("修改", assetUsePath); texture.textureType = TextureImporterType.Sprite; // texture.spritePixelsPerUnit = 1; // texture.filterMode = FilterMode.Trilinear; // texture.mipmapEnabled = false; // texture.textureFormat = TextureImporterFormat.AutomaticTruecolor; AssetDatabase.ImportAsset(assetUsePath); } } Ctrl.print("OK"); }
public async Task FillContentTypes(SList list, bool fillAlsoWeb = true) { using (var context = CreateContext(list.Web.Url)) { if (list.ContentTypes == null) { var serverList = context.Web.Lists.GetById(list.Id); context.Load(serverList.ContentTypes, contentTypes => contentTypes.Include( ct => ct.StringId, ct => ct.Name )); await Task.Factory.StartNew(() => context.ExecuteQuery()); list.ContentTypes = Converter.ToContentTypes(serverList.ContentTypes); } if (list.Web.ContentTypes == null) { context.Load(context.Web.ContentTypes, contentTypes => contentTypes.Include( ct => ct.StringId, ct => ct.Name )); await Task.Factory.StartNew(() => context.ExecuteQuery()); list.Web.ContentTypes = Converter.ToContentTypes(context.Web.ContentTypes); } } }
/** 推送移动组 */ private void sendMoveList() { if (_sendLastTime == 0) { _sendLastTime = CommonSetting.moveListSendDelay; //需要裁剪 if (_moveListIndex > 0) { _moveList = _moveList.subList(_moveListIndex, _moveList.size()); _moveListIndex = 0; } Ctrl.print("sendMoveList"); if (_moveList.size() == 1) { CUnitMovePosRequest.create(_unit.instanceID, _d.moveType, _pos, _moveList.get(0)).send(); } else { CUnitMovePosListRequest.create(_unit.instanceID, _d.moveType, _pos, _moveList).send(); } } }
/** 服务器移动点组 */ public void onServerMovePosList(int type, SList <PosData> list, int moveTime) { PosData[] values = list.getValues(); for (int i = 0, len = list.size(); i < len; ++i) { BaseGameUtils.makeTerrainPos(values[i]); } clearMoveList(); _moveList.addAll(list); if (CommonSetting.needMoveLerp) { setServerMoveRatio(list.get(0), moveTime); } clearBaseMove(); _d.baseMoveState = UnitBaseMoveState.MoveToPos; _d.moveType = type; _currentMoveIsInitiative = false; _moveListIndex = 0; doMoveList(); }
protected override void toMakeTargets(SList <Unit> list, Unit from, Unit attacker, Unit mTarget, SkillTargetData tData, AttackConfig config, AttackLevelConfig levelConfig) { if (!_g13) { _m13 = instance.Type.GetMethod("toMakeTargets", 7); _g13 = true; } if (_m13 != null && !_b13) { _b13 = true; _p7[0] = list; _p7[1] = from; _p7[2] = attacker; _p7[3] = mTarget; _p7[4] = tData; _p7[5] = config; _p7[6] = levelConfig; appdomain.Invoke(_m13, instance, _p7); _p7[0] = null; _p7[1] = null; _p7[2] = null; _p7[3] = null; _p7[4] = null; _p7[5] = null; _p7[6] = null; _b13 = false; } else { base.toMakeTargets(list, from, attacker, mTarget, tData, config, levelConfig); } }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); int valueLen = stream.readLen(); if (this.value != null) { this.value.clear(); this.value.ensureCapacity(valueLen); } else { this.value = new SList <TriggerObjData>(); } SList <TriggerObjData> valueT = this.value; for (int valueI = valueLen - 1; valueI >= 0; --valueI) { TriggerObjData valueV; valueV = (TriggerObjData)stream.readDataSimpleNotNull(); valueT.add(valueV); } }
/** 初始化 */ public void init() { _fixedTimer = Ctrl.getFixedTimer(); _inited = true; SList <SceneLogicBase> logics = _logics; SceneLogicBase logic; for (int i = 0, len = logics.Count; i < len; ++i) { if ((logic = logics[i]).enabled) { logic.init(); } } // for(int i=0,len=logics.Count;i<len;++i) // { // if((logic=logics[i]).enabled) // { // logic.afterInit(); // } // } }
/** 析构 */ public void dispose() { //移除所有单位 foreach (Unit v in _units) { v.removeAbs(); } SList <SceneLogicBase> logics = _logics; SceneLogicBase logic; for (int i = 0, len = logics.Count; i < len; ++i) { if ((logic = logics[i]).enabled) { logic.dispose(); } else { logic.enabled = true; } } _inited = false; _hero = null; }
/** 初始化碰撞系列的子弹所需 */ 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>(); } }
public static Definition Analyze(SList expr) { if (expr[1] is SAtom varExpr) { // Example: (define foo (+ 42 42)) if (expr.Count != 3) { throw new BadSyntaxException(KeyWord, string.Empty, expr.Text); } string variable = varExpr.Text; Expression valueExpression = Analyzer.Analyze(expr[2]); return(new Definition(variable, valueExpression)); } else { // Example (define (foo x y) (+ x y)) var procNameAndParams = from item in ((SList)expr[1]).Cast <SAtom>() select item.Text; string procName = procNameAndParams.First(); var procParams = procNameAndParams.Skip(1); var procBody = from sExpr in expr.Skip(2) select Analyzer.Analyze(sExpr); Expression lambda = new Lambda(procParams, procBody); return(new Definition(procName, lambda)); } }
/// <summary> /// Search for the first argument with the given name. Returns true if found the parameter, false otherse. /// The resulting parameter will be on the out Pair argument. /// </summary> public static bool TryGetArgumentByName(SimpleList <Pair <string, string> > arguments, string parameterName, out Pair <string, string> parameter) { parameter = SList.Find(arguments, pair => string.Equals(pair.Key, parameterName, StringComparison.InvariantCultureIgnoreCase)); // since pair is a struct (always not null), we need to validate if the key AND value is null return(!(string.IsNullOrEmpty(parameter.Key) && string.IsNullOrEmpty(parameter.Value))); }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { base.toReadBytesSimple(stream); this.type = stream.readInt(); int targetsLen = stream.readLen(); if (this.targets != null) { this.targets.clear(); this.targets.ensureCapacity(targetsLen); } else { this.targets = new SList <PosData>(); } SList <PosData> targetsT = this.targets; for (int targetsI = targetsLen - 1; targetsI >= 0; --targetsI) { PosData targetsV; targetsV = (PosData)stream.createData(PosData.dataID); targetsV.readBytesSimple(stream); targetsT.add(targetsV); } this.moveTime = stream.readInt(); }
/** 取圆形最近的战斗单位组 */ public void getCircleRandomFightUnits(SList <Unit> list, PosData pos, float radius, int max, float height, Unit selfUnit, bool[] influences) { getCircleFightUnits(list, pos, radius, height, selfUnit, influences); if (max > 0 && list.length() > max) { //随机排序 int len = list.length(); Unit temp; for (int i = 0; i < max; ++i) { int j = MathUtils.randomRange(i, len); if (i != j) { temp = list[i]; list[i] = list[j]; list[j] = temp; } } list.cutToLength(max); } }
/// <summary> /// 读取字节流(简版) /// </summary> protected override void toReadBytesSimple(BytesReadStream stream) { this.index = stream.readInt(); int listLen = stream.readLen(); if (this.list != null) { this.list.clear(); this.list.ensureCapacity(listLen); } else { this.list = new SList <ClientOfflineWorkData>(); } SList <ClientOfflineWorkData> listT = this.list; for (int listI = listLen - 1; listI >= 0; --listI) { ClientOfflineWorkData listV; listV = (ClientOfflineWorkData)stream.readDataSimpleNotNull(); listT.add(listV); } this.clientRandomSeedIndex = stream.readInt(); }
/** 取矩形战斗单位组 */ public void getRectFightUnits(SList <Unit> list, PosData pos, DirData dir, float length, float width, float height, Unit selfUnit, bool[] influences) { list.clear(); ScenePosLogic posLogic = _scene.pos; PosData tempPos = _tempPos2; DirData tempDir = _tempDir2; //向后延伸 posLogic.polar2D(tempPos, Global.attackScopeBackLength, dir); posLogic.addPos2D(tempPos, pos); float halfWidth = width / 2f; float useLength = length + Global.attackScopeBackLength; float sq = halfWidth * halfWidth + useLength * useLength; Unit[] values; Unit k; for (int i = (values = _scene.getFightUnitDic().getValues()).Length - 1; i >= 0; --i) { if ((k = values[i]) != null) { PosData kPos = k.pos.getPos(); //高度值合适 if (height <= 0 || posLogic.getDHeight(kPos, pos) <= height) { float dq; //在圆形范围内 if ((dq = posLogic.calculatePosDistanceSq2D(kPos, pos)) <= sq) { //符合影响类型 if (selfUnit.fight.checkTargetInfluence(k, influences)) { float d = (float)Math.Sqrt(dq); posLogic.calculateDirByPos2D(tempDir, tempPos, kPos); float dirV = dir.direction - tempDir.direction; float h = (float)(Math.Cos(dirV) * d); float w = (float)(Math.Sin(dirV) * d); if (Math.Abs(w) <= halfWidth) { if (h >= 0 && h <= useLength) { list.add(k); } } } } } } } }
/** 取圆形战斗单位组 */ public void getCircleFightUnits(SList <Unit> list, PosData pos, float radius, float height, Unit selfUnit, bool[] influences) { list.clear(); ScenePosLogic posLogic = _scene.pos; float sq = radius * radius; Unit[] values; Unit k; for (int i = (values = _scene.getFightUnitDic().getValues()).Length - 1; i >= 0; --i) { if ((k = values[i]) != null) { PosData kPos = k.pos.getPos(); //高度合适 if (height <= 0 || posLogic.getDHeight(kPos, pos) <= height) { //在范围内 if (posLogic.calculatePosDistanceSq2D(kPos, pos) <= sq) { //符合影响类型 if (selfUnit.fight.checkTargetInfluence(k, influences)) { list.add(k); } } } } } }
SList pFileList(bool justone) { SList h = new SList(); SList t = h; while (!scn.EOT()) { t.nxt = new SList(); t = t.nxt; if (scn.C == '"') { char d = pDelim(); scn.GetChar(); scn.SetDelim(d); t.s = scn.GetStr(); } else { t.s = scn.GetStrSpDelim(); } if (justone) { return(h.nxt); } } return(h.nxt); }
/// <summary> /// Remove all elements of the set. /// </summary> public static void Clear <TKey>(SimpleSet <TKey> set) { for (int i = 0; i < set.Capacity; i++) { var entry = set.Entries[i]; if (entry == null) { continue; } set.Entries[i] = null; entry.Key = default(TKey); entry.HashCode = -1; SList.Add(set.EntryPool, entry); while (entry.Next != null) { entry = entry.Next; entry.Key = default(TKey); entry.HashCode = -1; SList.Add(set.EntryPool, entry); } } set.Count = 0; }
public void FillListFields(SList list) { using (var site = CreateSite(list.Web.Url)) { using (var web = site.OpenWeb()) { var serverList = web.Lists.TryGetList(list.Title); list.Fields = serverList.Fields.Cast<SPField>().Select(f => new Field { Id = f.Id, IsHidden = f.Hidden, IsReadonly = f.ReadOnlyField, Title = f.Title, InternalName = f.InternalName, Group = f.Group, Type = (FieldType)f.Type }).ToList(); } } }