private void Load(IDocumentData data) { var flags = FlagsManager.LoadFlags(DefaultMerger.AddDefaults(data.DocumentWideFlags)); this.pageCollection = this.elementFactory.CreatePageCollection(flags); this.pageCollection.SetCursor(false, this.cursor); }
private void _update() { if (!SdeAppConfiguration.IronPythonAutocomplete) { if (_completionWindow != null) { _completionWindow.Close(); } return; } // Open code completion after the user has pressed dot: if (_completionWindow == null || !_completionWindow.IsVisible) { if (_li.Parent != null) { ((CompletionWindow)_li.Parent).Content = null; } _completionWindow = new CompletionWindow(_textEditor.TextArea, _li); _completionWindow.Changed += new EventHandler(_completionWindow_Changed); _completionWindow.Closed += delegate { if (_completionWindow != null) { _completionWindow.Content = null; } _completionWindow = null; }; } RangeObservableCollectionX <ICompletionData> data = (RangeObservableCollectionX <ICompletionData>)_li.CompletionData; data.Clear(); string word = AvalonLoader.GetWholeWordAdv(_textEditor.TextArea.Document, _textEditor); List <string> words = PythonEditorList.Tables.Where(p => p.IndexOf(word, StringComparison.OrdinalIgnoreCase) != -1).OrderBy(p => p).ToList(); List <string> constants = PythonEditorList.Constants.Where(p => p.IndexOf(word, StringComparison.OrdinalIgnoreCase) != -1).OrderBy(p => p).ToList(); List <string> flags = FlagsManager.GetFlagNames().Where(p => p.IndexOf(word, StringComparison.OrdinalIgnoreCase) != -1).OrderBy(p => p).ToList(); if (words.Count == 0 && constants.Count == 0 && flags.Count == 0) { _completionWindow.Close(); return; } IEnumerable <ICompletionData> results = words.Select(p => (ICompletionData) new MyCompletionData(p, _textEditor, DataType.Function)). Concat(constants.Select(p => (ICompletionData) new MyCompletionData(p, _textEditor, DataType.Constant))). Concat(flags.Select(p => (ICompletionData) new MyCompletionData(p, _textEditor, DataType.Constant))); data.AddRange(results); _completionWindow.CompletionList.ListBox.ItemsSource = data; _completionWindow.Show(); _completionWindow.CompletionList.SelectedItem = _completionWindow.CompletionList.CompletionData.FirstOrDefault(p => String.Compare(p.Text, word, StringComparison.OrdinalIgnoreCase) >= 0); _completionWindow.CompletionList.ListBox.ScrollToCenterOfView(_completionWindow.CompletionList.SelectedItem); }
void Awake() { if(manager) Destroy(gameObject); else{ manager = this; DontDestroyOnLoad(gameObject); } }
public static void ExpandFlagYaml <T>(StringBuilder builder, ReadableTuple <int> tuple, string name, DbAttribute attribute, string indent1, string indent2, Func <bool> isExtra = null, Action extra = null) { long value = FormatConverters.LongOrHexConverter(tuple.GetValue <string>(attribute)); if (value != 0 || (isExtra != null && isExtra())) { if (name != "") { builder.Append(indent1); builder.Append(name); builder.AppendLine(": {"); } var flagsData = FlagsManager.GetFlag <T>(); if (flagsData != null) { foreach (var v in flagsData.Values) { long vF = v.Value; if ((v.DataFlag & FlagDataProperty.Hide) == FlagDataProperty.Hide) { continue; } if ((vF & value) == vF) { builder.Append(indent2); builder.Append(v.Name); builder.AppendLine(": true"); } } } else { foreach (var v in Enum.GetValues(typeof(T)).Cast <T>()) { int vF = (int)(object)v; if ((vF & value) == vF) { builder.Append(indent2); builder.Append(Constants.ToString(v)); builder.AppendLine(": true"); } } } if (extra != null) { extra(); } builder.Append(indent1); builder.AppendLine("}"); } }
private void New() { var flags = FlagsManager.LoadFlags(Defaults.DocumentWideFlags); this.pageCollection = this.elementFactory.CreatePageCollection(flags); // TODO: Set back to page collection this.pageCollection.Region.SetParent(this.frame); this.pageCollection.Region.SetPoint(FramePoint.TOPLEFT, this.frame, FramePoint.TOPLEFT, 20, -20); this.pageCollection.SetCursor(false, this.cursor); }
public void playSound() { if (FlagsManager.getFlag(0)) { if (!walkingSound.isPlaying) { walkingSound.Play(); } } }
void Awake() { if (manager) { Destroy(gameObject); } else { manager = this; DontDestroyOnLoad(gameObject); } }
private void Update() { if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.LeftArrow)) { FlagsManager.setFlag(0, true); } else { FlagsManager.setFlag(0, false); } m_PlayerMotor.m_Velociy = getCurrentVelocity(); }
public static string ToString <TValue>(int key) { var flagsData = FlagsManager.GetFlag <TValue>(); if (flagsData != null) { return(flagsData.Value2Name[key]); } var dico = (Dictionary <TValue, string>)_dicosEnums2Strings[typeof(TValue)]; return(_getValue(dico, (TValue)(object)key)); }
private string _findWeaponType(ReadableTuple <int> tupleSource) { var viewId = _getInt(ServerItemAttributes.ClassNumber, tupleSource); var viewId2 = _getInt(ServerItemAttributes.SubType, tupleSource); if (viewId2 > 0) { var flagsData = FlagsManager.GetFlag <WeaponType>(); var v = flagsData.Values.FirstOrDefault(p => p.Value == viewId2); if (v != null) { var index = flagsData.Values.IndexOf(v); return(WeaponTypes[index]); } } if (viewId > 0 && viewId < WeaponTypes.Count) { return(WeaponTypes[viewId]); } return(null); }
public static string LoadFlag <T>(ParserObject entry, string def = "") { if (entry == null) { return(def); } long flag = 0; var flagData = FlagsManager.GetFlag <T>(); if (flagData == null) { throw new FileParserException(TextFileHelper.LatestFile, entry.Line, "Unknown flag provided: " + typeof(T)); } if (entry is ParserString) { long val; if (!flagData.Name2Value.TryGetValue(entry.ObjectValue, out val)) { FlagsManager.AddValue(flagData, entry.ObjectValue); } if (!flagData.Name2Value.TryGetValue(entry.ObjectValue, out val)) { throw new FileParserException(TextFileHelper.LatestFile, entry.Line, "Unknown flag: " + entry.ObjectValue); } return(flagData.Name2Value[entry.ObjectValue].ToString(CultureInfo.InvariantCulture)); } foreach (var flagEntry in entry.OfType <ParserKeyValue>()) { try { long val = 0; if (!flagData.Name2Value.TryGetValue(flagEntry.Key, out val)) { FlagsManager.AddValue(flagData, flagEntry.Key); } if (!flagData.Name2Value.TryGetValue(flagEntry.Key, out val)) { throw new FileParserException(TextFileHelper.LatestFile, entry.Line, "Unknown flag: " + flagEntry.Key); } if (flagEntry.Value == "true") { flag |= val; } else { flag &= ~val; } } catch { throw new FileParserException(TextFileHelper.LatestFile, entry.Line, "Unknown flag: " + flagEntry.Key); } } if (flag == 0 && def != "") { return(def); } return(flag.ToString(CultureInfo.InvariantCulture)); }
public static void WriteEntryYaml(StringBuilder builder, ReadableTuple <int> tuple, MetaTable <int> itemDb) { if (tuple != null) { int value; bool valueB; string valueS; builder.AppendLine(" - Id: " + tuple.GetKey <int>().ToString(CultureInfo.InvariantCulture)); if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.Name)) != "") { builder.AppendLine(" Name: " + DbIOUtils.QuoteCheck(valueS)); } if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.Desc)) != "") { builder.AppendLine(" Description: " + DbIOUtils.QuoteCheck(valueS)); } builder.AppendLine(" MaxLevel: " + tuple.GetValue <int>(ServerSkillAttributes.MaxLevel)); if ((value = tuple.GetValue <int>(ServerSkillAttributes.AttackType)) != 0) { builder.AppendLine(" Type: " + Constants.ToString <AttackTypeType>(value)); } if ((value = tuple.GetValue <int>(ServerSkillAttributes.SkillTargetType)) != 0) { builder.AppendLine(" TargetType: " + Constants.ToString <SkillTargetType>(value)); } DbIOUtils.ExpandFlag <SkillDamageType>(builder, tuple, "DamageFlags", ServerSkillAttributes.DamageFlags, YamlParser.Indent4, YamlParser.Indent6); DbIOUtils.ExpandFlag <SkillType2TypeNew>(builder, tuple, "Flags", ServerSkillAttributes.Inf2New, YamlParser.Indent4, YamlParser.Indent6); _expandList(builder, tuple, "Range", " - Level", "Size", ServerSkillAttributes.Range, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); if ((value = tuple.GetValue <int>(ServerSkillAttributes.HitMode)) != 0) { builder.AppendLine(" Hit: " + Constants.ToString <HitType>(value)); } _expandList(builder, tuple, "HitCount", " - Level", "Count", ServerSkillAttributes.HitCount, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "Element", " - Level", "Element", ServerSkillAttributes.SkillElement, YamlParser.Indent4, YamlParser.Indent8, "Neutral", itemDb); _expandList(builder, tuple, "SplashArea", " - Level", "Area", ServerSkillAttributes.SplashArea, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "ActiveInstance", " - Level", "Max", ServerSkillAttributes.ActiveInstance, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "Knockback", " - Level", "Amount", ServerSkillAttributes.Knockback, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); if (tuple.GetValue <int>(ServerSkillAttributes.CopyFlags) > 0 || tuple.GetValue <int>(ServerSkillAttributes.CopyFlagsRemovedRequirement) > 0) { builder.AppendLine(" CopyFlags:"); DbIOUtils.ExpandFlag <SkillCopyType>(builder, tuple, "Skill", ServerSkillAttributes.CopyFlags, YamlParser.Indent6, YamlParser.Indent8); DbIOUtils.ExpandFlag <SkillCopyRemoveRequirementType>(builder, tuple, "RemoveRequirement", ServerSkillAttributes.CopyFlagsRemovedRequirement, YamlParser.Indent6, YamlParser.Indent8); } if (tuple.GetValue <int>(ServerSkillAttributes.NoNearNPCRange) > 0 || tuple.GetValue <int>(ServerSkillAttributes.NoNearNPCType) > 0) { builder.AppendLine(" NoNearNPC:"); if ((value = tuple.GetValue <int>(ServerSkillAttributes.NoNearNPCRange)) != 0) { builder.AppendLine(" AdditionalRange: " + value); } DbIOUtils.ExpandFlag <NoNearNpcType>(builder, tuple, "Type", ServerSkillAttributes.NoNearNPCType, YamlParser.Indent6, YamlParser.Indent8); } if ((valueB = tuple.GetValue <bool>(ServerSkillAttributes.CastInterrupt)) != false) { builder.AppendLine(" CastCancel: " + (valueB ? "true" : "false")); } if ((value = tuple.GetValue <int>(ServerSkillAttributes.CastDefenseReduction)) != 0) { builder.AppendLine(" CastDefenseReduction: " + value); } _expandList(builder, tuple, "CastTime", " - Level", "Time", ServerSkillAttributes.CastingTime, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "AfterCastActDelay", " - Level", "Time", ServerSkillAttributes.AfterCastActDelay, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "AfterCastWalkDelay", " - Level", "Time", ServerSkillAttributes.AfterCastWalkDelay, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "Duration1", " - Level", "Time", ServerSkillAttributes.Duration1, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "Duration2", " - Level", "Time", ServerSkillAttributes.Duration2, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "Cooldown", " - Level", "Time", ServerSkillAttributes.Cooldown, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); _expandList(builder, tuple, "FixedCastTime", " - Level", "Time", ServerSkillAttributes.FixedCastTime, YamlParser.Indent4, YamlParser.Indent8, "0", itemDb); DbIOUtils.ExpandFlag <CastingFlags>(builder, tuple, "CastTimeFlags", ServerSkillAttributes.CastTimeFlags, YamlParser.Indent4, YamlParser.Indent6); DbIOUtils.ExpandFlag <CastingFlags>(builder, tuple, "CastDelayFlags", ServerSkillAttributes.CastDelayFlags, YamlParser.Indent4, YamlParser.Indent6); StringBuilder require = new StringBuilder(); _expandList(require, tuple, "HpCost", " - Level", "Amount", ServerSkillAttributes.RequireHpCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(require, tuple, "SpCost", " - Level", "Amount", ServerSkillAttributes.RequireSpCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(require, tuple, "HpRateCost", " - Level", "Amount", ServerSkillAttributes.RequireHpRateCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(require, tuple, "SpRateCost", " - Level", "Amount", ServerSkillAttributes.RequireSpRateCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(require, tuple, "MaxHpTrigger", " - Level", "Amount", ServerSkillAttributes.RequireMaxHpTrigger, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(require, tuple, "ZenyCost", " - Level", "Amount", ServerSkillAttributes.RequireZenyCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); value = tuple.GetValue <int>(ServerSkillAttributes.RequireWeapons); if (value != 0xFFFFFF) { DbIOUtils.ExpandFlag <WeaponType>(require, tuple, "Weapon", ServerSkillAttributes.RequireWeapons, YamlParser.Indent6, YamlParser.Indent8); } DbIOUtils.ExpandFlag <AmmoType>(require, tuple, "Ammo", ServerSkillAttributes.RequireAmmoTypes, YamlParser.Indent6, YamlParser.Indent8); _expandList(require, tuple, "AmmoAmount", " - Level", "Amount", ServerSkillAttributes.RequireAmmoAmount, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); if ((value = tuple.GetValue <int>(ServerSkillAttributes.RequireState)) > 0) { valueS = ""; switch ((RequiredStateTypeNew)value) { case RequiredStateTypeNew.Hidden: valueS = "Hidden"; break; case RequiredStateTypeNew.Riding: valueS = "Riding"; break; case RequiredStateTypeNew.Falcon: valueS = "Falcon"; break; case RequiredStateTypeNew.Cart: valueS = "Cart"; break; case RequiredStateTypeNew.Shield: valueS = "Shield"; break; case RequiredStateTypeNew.RecoverWeightRate: valueS = "Recover_Weight_Rate"; break; case RequiredStateTypeNew.MoveEnable: valueS = "Move_Enable"; break; case RequiredStateTypeNew.Water: valueS = "Water"; break; case RequiredStateTypeNew.RidingDragon: valueS = "Ridingdragon"; break; case RequiredStateTypeNew.Warg: valueS = "Wug"; break; case RequiredStateTypeNew.Ridingwarg: valueS = "Ridingwug"; break; case RequiredStateTypeNew.Mado: valueS = "Mado"; break; case RequiredStateTypeNew.Elementalspirit: valueS = "Elementalspirit"; break; case RequiredStateTypeNew.Elementalspirit2: valueS = "Elementalspirit2"; break; case RequiredStateTypeNew.RidingPeco: valueS = "Peco"; break; case RequiredStateTypeNew.SunStance: valueS = "Sunstance"; break; case RequiredStateTypeNew.MoonStance: valueS = "Moonstance"; break; case RequiredStateTypeNew.StarsStance: valueS = "Starstance"; break; case RequiredStateTypeNew.UniverseStance: valueS = "Universestance"; break; default: valueS = ""; break; } require.Append(" State: "); require.AppendLine(valueS); } if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.RequireStatuses)) != "" && valueS != "0") { var data = valueS.Split(':'); if (data.Length > 0) { require.AppendLine(" Status:"); foreach (var da in data) { require.Append(" "); require.Append(da); require.AppendLine(": true"); } } } //_DbIOUtils.ExpandFlag<AmmoType>(require, tuple, "Status", ServerSkillAttributes.RequireStatuses, YamlParser2.Indent6, YamlParser2.Indent8); _expandList(require, tuple, "SpiritSphereCost", " - Level", "Amount", ServerSkillAttributes.RequireSpiritSphereCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(require, tuple, "ItemCost", " - Item", "Amount", ServerSkillAttributes.RequireItemCost, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.RequiredEquipment)) != "" && valueS != "0") { var data = valueS.Split(':'); require.AppendLine(" Equipment:"); foreach (var item in data) { require.Append(" "); require.Append(DbIOUtils.Id2Name(itemDb, ServerItemAttributes.AegisName, item)); require.AppendLine(": true"); } } //_expandList(require, tuple, "Equipment", "", "", ServerSkillAttributes.RequiredEquipment, YamlParser2.Indent6, YamlParser2.Indent8, "", itemDb); string requireData = require.ToString(); if (requireData != "") { builder.AppendLine(" Requires:"); builder.Append(requireData); } StringBuilder unit = new StringBuilder(); if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.UnitId)) != "" && valueS != "0") { unit.Append(" Id: "); unit.AppendLine(valueS); } if ((valueS = tuple.GetValue <string>(ServerSkillAttributes.UnitAlternateId)) != "" && valueS != "0") { unit.Append(" AlternateId: "); unit.AppendLine(valueS); } _expandList(unit, tuple, "Layout", " - Level", "Size", ServerSkillAttributes.UnitLayout, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); _expandList(unit, tuple, "Range", " - Level", "Size", ServerSkillAttributes.UnitRange, YamlParser.Indent6, YamlParser.Indent10, "0", itemDb); if ((value = tuple.GetValue <int>(ServerSkillAttributes.UnitInterval)) != 0) { unit.Append(" Interval: "); unit.AppendLine(value.ToString(CultureInfo.InvariantCulture)); } if ((value = tuple.GetValue <int>(ServerSkillAttributes.UnitTarget)) != 0x3F0000) { unit.Append(" Target: "); var flag = FlagsManager.GetFlag <UnitTargetType>(); valueS = flag.Value2Name[value]; unit.AppendLine(valueS); } DbIOUtils.ExpandFlag <UnitFlagType>(unit, tuple, "Flag", ServerSkillAttributes.UnitFlag, YamlParser.Indent6, YamlParser.Indent8); string unitData = unit.ToString(); if (unitData != "") { builder.AppendLine(" Unit:"); builder.Append(unit); } } }
public override Func <TValue, string, double> ToInt <TKey, TValue>(GTabSettings <TKey, TValue> settings, out bool isInt) { isInt = false; if (Value.StartsWith("[") && Value.EndsWith("]")) { string se = Value.Substring(1, Value.Length - 2); var att = settings.AttributeList.Find(se); bool?canDirect = null; if (att >= 0) { return(new Func <TValue, string, double>((t, s) => { int ival2; if (canDirect == true) { try { ival2 = t.GetValue <int>(att); return ival2; } catch { canDirect = false; } } string val = t.GetValue <string>(att); if (canDirect == null) { try { ival2 = t.GetValue <int>(att); return ival2; } catch { canDirect = false; } } if (!Int32.TryParse(val, out ival2)) { if (val.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) { ival2 = FormatConverters.IntOrHexConverter(val); } } return ival2; })); } return(new Func <TValue, string, double>((t, s) => 0)); } if (Value.StartsWith("Flags.")) { string f = Value.ReplaceFirst("Flags.", ""); isInt = true; long val = FlagsManager.GetFlagValue(f); return(new Func <TValue, string, double>((t, s) => val)); } double ival; if (double.TryParse(Value.Replace(".", ","), out ival)) { isInt = true; } else if (double.TryParse(Value.Replace(",", "."), out ival)) { isInt = true; } else { if (Value.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) { ival = FormatConverters.IntOrHexConverter(Value); isInt = true; } } return(new Func <TValue, string, double>((t, s) => ival)); }