protected override void OnAttached() { // Get the Android View corresponding to the Element that the effect is attached to view = Control == null ? Container : Control; // Get access to the TouchEffect class in the .NET Standard library TEffect touchEffect = (TEffect)Element.Effects. FirstOrDefault(e => e is TEffect); if (touchEffect != null && view != null) { viewDictionary.Add(view, this); formsElement = Element; libTouchEffect = touchEffect; // Save fromPixels function fromPixels = view.Context.FromPixels; // Set event handler on View view.Touch += OnTouch; } }
//Indikatioren für Varibeltypen //§=TriggerValue,constantValue //$=StringValue //%=NumericValue //Aufbau des Sykripts //Trigger //Variabel //Skript public EffectScriptObject(string _Script, IRPGSource _Source, RPGObject _Target, TEffect _Effect) { Source = _Source; Afflicted = _Target; string[] Lines = _Script.Split (';'); int state = 0; for (int i=0; i<Lines.Length; i++) { Lines [i] = Lines [i].ToLower (); if (Lines [i] == "endblock") { state++; continue; } if (state == 0) { //Trigger } else if (state == 1) { //Variablen string varstring = Lines [i]; if (varstring [0] == '$') { sValues.Add (new StringValue (varstring.Split ('=') [0].TrimStart ('$'), varstring.Split ('=') [1])); } if (varstring [0] == '%') { nValues.Add (new NumericValue (varstring.Split ('=') [0].TrimStart ('%'), System.Convert.ToInt16 (varstring.Split ('=') [1]))); } } else if (state == 2) { //Script Script.Add (Lines [i]); } } }
public b_accuracy_by_night(double value, int skillId, int lvl) { this.value = value; effect = new b_accuracy(); effect.HashID = skillId * 65536 + lvl; effect.SkillId = skillId; effect.SkillLv = lvl; effect.build("st +" + value); }
public double[] Apply(TEffect effect) { activeEffects.Add(effect); double basevalue = getTemplate(effect.type); double newvalue = basevalue; double buffvalue = getStat(effect.type); List <TEffect> arif = null; foreach (TEffect cc in activeEffects) { if (cc.type != effect.type) { continue; } if (cc.supMethod != null) { if (cc.supMethod.Method <= SupMethod.SUB) { if (arif == null) { arif = new List <TEffect>(); } arif.Add(cc); continue; } newvalue = calcSupMethod(newvalue, cc.supMethod); } // Console.WriteLine("newvalue! #1 " + newvalue + " " + cc.supMethod.Value+" "+cc.type); } if (arif != null) { foreach (TEffect cc in arif) { newvalue = calcSupMethod(newvalue, cc.supMethod); // Console.WriteLine("newvalue! arif " + newvalue + " " + cc.supMethod.Value+" "+cc.type); } } if (statBuff.ContainsKey(effect.type)) { lock (statBuff) statBuff.Remove(effect.type); } statBuff.Add(effect.type, newvalue); return(new double[] { buffvalue, newvalue }); }
/// <summary> /// Toggles an effect on or off. /// </summary> public void Toggle <TEffect> () where TEffect : Behaviour { Riff riff = RiffEditor.CurrentRiff; Instrument inst = riff.Instrument; AudioSource source = MusicManager.Instance.GetAudioSource(inst); // Toggle effect TEffect effect = source.GetComponent <TEffect>(); effect.enabled = !effect.enabled; // Update riff Type effectType = typeof(TEffect); if (effectType == typeof(AudioDistortionFilter)) { riff.DistortionEnabled = effect.enabled; } else if (effectType == typeof(AudioEchoFilter)) { riff.EchoEnabled = effect.enabled; } else if (effectType == typeof(AudioReverbFilter)) { riff.ReverbEnabled = effect.enabled; } else if (effectType == typeof(AudioTremoloFilter)) { riff.TremoloEnabled = effect.enabled; } else if (effectType == typeof(AudioChorusFilter)) { riff.ChorusEnabled = effect.enabled; } else if (effectType == typeof(AudioFlangerFilter)) { riff.FlangerEnabled = effect.enabled; } // Update button art _image.sprite = (effect.enabled ? UIManager.Instance.FilledPercussionNoteIcon : UIManager.Instance.EmptyPercussionNoteIcon); // Play sound if (effect.enabled) { UIManager.Instance.PlayEnableEffectSound(); } else { UIManager.Instance.PlayDisableEffectSound(); } }
public Counter(int _Order, string _SourceTyp, TEffect _SourceEffect) { Order = _Order; SourceTyp = _SourceTyp; SourceEffect = _SourceEffect; }
protected virtual bool _removeEffect(TEffect effect,bool enforceRemove=false) { if (enforceRemove && effect.oDuration != -1) { OnRemoveEffect (effect); cEffects.Remove (effect); return true; } return false; }
protected virtual bool _addEffect(TEffect Effect,IRPGSource source) { //Überprüfe zunächst ob ein Schutz gegen den Effekt exestiert if (!cEffects.Exists (delegate(TEffect obj) { foreach (string effs in obj.WorkingPassiveEffectStrings) { string[] splitted = effs.Split (' '); if (splitted [0] == "protectagainst" && (splitted [1] == Effect.GeneralCategory || Effect.Tags.Contains (splitted [1])) && System.Convert.ToInt16 (splitted [2]) > Effect.GeneralOrder) return true; } return false; })) { OnNewEffect (Effect);//Füge den neuen Effekt in das Helper System ein cEffects.Add (Effect);//Füge ihn in die Liste der Effekte ein Effect.HookUp(source,this,IDCounter++); // UpdateStatistics ();//Aktualisiere die Statisitk(wird erst nach anknüpfen aller Effekte von der Gegenseite aufgerufen!) return true;//Effekt erfolgreich hinzugefügt! } return false;//Effekt konnte nicht hinzugefügt werden! }
//Diese Funktion entfernt den Effekt aus allen Helpern protected void OnRemoveEffect(TEffect effect) { foreach (string s in effect.PassiveEffectStrings) { string[] splitted = s.Split (' '); //Überprüfe ob effect ein Modifiktor oder Inhibitor war if (splitted [0] == "add" || splitted [0] == "block" || splitted [0] == "counter") { //Wähle den entsprechenden AttributsHelfer aus AttributModificationHelper AMH = AttributeHelper.Find (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; }); //Finde die Liste der Modifikation mit selber SourceType List<AttributModificationHelper.Modification> ml = AMH.AllModifications.Find (delegate(List<AttributModificationHelper.Modification> obj) { return obj [0].SourceType == splitted [2]; }); //Lösche Einträge in Inhibitoren AMH.Inhibitors.RemoveAll (delegate(AttributModificationHelper.Inhibitor obj) { return obj.SourceEffect == effect; }); //Lösche Einträge in der ModifikationsListe ml.RemoveAll (delegate(AttributModificationHelper.Modification obj) { return obj.SourceEffect == effect; }); //Lösche Einträge aus den COunter AMH.Counters.RemoveAll (delegate(AttributModificationHelper.Counter obj) { return obj.SourceEffect == effect; }); //Eine leere Source-Liste wird entfernt if (ml.Count == 0) AMH.AllModifications.Remove (ml); //Ein leerer Attributshelfer wird entfernt... if (AMH.AllModifications.Count == 0 && AMH.Inhibitors.Count == 0 && AMH.Counters.Count == 0) AttributeHelper.Remove (AMH); } } }
//Diese Funktion baut einen neuen Effekt in die Helper ein protected void OnNewEffect(TEffect effect) { foreach (string eff in effect.PassiveEffectStrings) { string[] splitted = eff.Split (' '); //Überprüfen ob es ein Modifikator oder ein Inhibitor ist. if (splitted [0] == "add") { //Platz für den Wert machen, sofern nicht vorhanden if (!AttributeHelper.Exists (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; })) AttributeHelper.Add (new AttributModificationHelper (splitted [1])); //Entsprechenden AttributsHelfer auswählen AttributModificationHelper AMH = AttributeHelper.Find (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; }); //Evt. Platz für die neue Quelle machen und Effekt direkt einfügen if (!AMH.AllModifications.Exists (delegate(List<AttributModificationHelper.Modification> obj) { return obj [0].SourceType == splitted [2]; })) { AMH.AllModifications.Insert (0, new List<AttributModificationHelper.Modification> ()); AMH.AllModifications [0].Add (new AttributModificationHelper.Modification (splitted [2], System.Convert.ToSingle (splitted [4].TrimEnd ('%').TrimEnd ('%')), System.Convert.ToInt16 (splitted [3]), splitted [4].Contains ("%%"), effect)); } else AMH.AllModifications.Find (delegate(List<AttributModificationHelper.Modification> obj) { return obj [0].SourceType == splitted [2]; }).Add (new AttributModificationHelper.Modification (splitted [2], System.Convert.ToSingle (splitted [4].TrimEnd ('%').TrimEnd ('%')), System.Convert.ToInt16 (splitted [3]), splitted [4].Contains ("%%"), effect)); } else if (splitted [0] == "block") { //Platz für den Wert machen, sofern nicht vorhanden if (!AttributeHelper.Exists (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; })) AttributeHelper.Add (new AttributModificationHelper (splitted [1])); //Entsprechenden AttributsHelfer auswählen AttributModificationHelper AMH = AttributeHelper.Find (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; }); //Evt. Platz für die neue Quelle machen und Effekt direkt einfügen AMH.Inhibitors.Add (new AttributModificationHelper.Inhibitor (splitted [2], System.Convert.ToInt16 (splitted [3]), effect)); } else { if (splitted [0] == "counter") { if (!AttributeHelper.Exists (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; })) AttributeHelper.Add (new AttributModificationHelper (splitted [1])); AttributModificationHelper AMH = AttributeHelper.Find (delegate(AttributModificationHelper obj) { return obj.AttributeName == splitted [1]; }); //Evt. Platz für die neue Quelle machen und Effekt direkt einfügen AMH.Counters.Add (new AttributModificationHelper.Counter (System.Convert.ToInt16 (splitted [3]), splitted [2], effect)); } } } }
public bool removeEffect(TEffect effect,bool enforceRemove=false) { MyNetworkManager.DistributeIDComponentUpdate (this, new IDComponentUpdateMsg (2,FileHelper.serializeObject<RemoveEffectMsg>(new RemoveEffectMsg(effect.getID(),enforceRemove)))); return _removeEffect (effect, enforceRemove); }
void ProcessCommandToEffect(TEffect target,string Command, string[] CallParameter, Paramter[] Triggerparameter) { }
public static void CreateEffect(IObject obj, string id, int time, int count) { TEffect effect = new TEffect(obj, id, time, count); EffectList.Add(effect); }
public Inhibitor(string sourcetyp, int order, TEffect sourceffect) { SourceTyp = sourcetyp; this.Order = order; SourceEffect = sourceffect; }
public bool addEffect(TEffect effect,IRPGSource source) { MyNetworkManager.DistributeIDComponentUpdate (this, new IDComponentUpdateMsg (1, FileHelper.serializeObject<AddEffectMsg> (new AddEffectMsg (effect, source.getID ())))); return _addEffect (effect, source); }
public Modification(string sourcetype, float value, int order, bool mode, TEffect sourceeffect) { SourceType = sourcetype; Value = value; Order = order; Mode = mode; SourceEffect = sourceeffect; }
public AddEffectMsg(TEffect e,string s) { effect = e; sourceID = s; }