public async Task <IActionResult> PutMotive([FromRoute] int id, [FromBody] Motive motive) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != motive.Id) { return(BadRequest()); } motive.UpdatedAt = DateTimeOffset.Now; _context.Entry(motive).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MotiveExists(id)) { return(NotFound()); } else { throw; } } return(Ok(_context.Motives.Find(id))); }
public void Generate() { int index = -1; if (LevelLoader.instance.doneQuest == -1) { index = RandomNumber.Range(0, 2); } else { if (LevelLoader.instance.canSwitch) { if (LevelLoader.instance.doneQuest == 0) { index = 1; } else { index = 0; } LevelLoader.instance.canSwitch = false; } else { index = LevelLoader.instance.doneQuest; } } LevelLoader.instance.doneQuest = index; start = listMotives.Motive[index].motives[0]; CreateQuestTree(); }
public static void Serialize(string path, Motive target) { using (StreamWriter fs = new StreamWriter(path)) { new XmlSerializer(typeof (Motive)).Serialize(fs, target); } }
public override void ClearPregnancyData() { if (mContractionBroadcast != null) { mContractionBroadcast.Dispose(); } if (mMom != null) { mMom.RemoveAlarm(PreggersAlarm); UnrequestPregnantWalkStyle(); if (!mMom.HasBeenDestroyed) { if (!mMom.SimDescription.IsVampire) { Motive motive = mMom.Motives.GetMotive(CommodityKind.Hunger); if (motive != null) { motive.PregnantMotiveDecay = false; } } Motive motive2 = mMom.Motives.GetMotive(CommodityKind.Bladder); if (motive2 != null) { motive2.PregnantMotiveDecay = false; } mMom.SimDescription.NullOutPregnancy(); } } }
private void End(Motive motive) { Target.Interrupt(motive); OnEnd(); onEnd?.Invoke(motive); }
PickAndPlaceData RememberBlocks() { var topLayer = Motive.GetTiles(_rect); if (topLayer == null) { Message = "Camera error."; return(null); } if (topLayer.Count == 0) { _isScanning = false; Message = "Finished scanning, rebuilding."; return(BuildBlocks()); } var pick = topLayer.First(); _pickTiles.Add(pick); var place = JengaLocation(_tileCount); _tileCount++; return(new PickAndPlaceData { Pick = pick, Place = place }); }
private void DrawFileControls() { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("New")) { if (EditorUtility.DisplayDialog("Are you sure?", "OK", "Cancel")) { mCurrentMotive = new Motive(); } } if (GUILayout.Button("Save")) { string path = EditorUtility.SaveFilePanel("Save Current Level", "", "NewLevel", "txt"); if (path.Length != 0) { Motive.Serialize(path, mCurrentMotive); } } if (GUILayout.Button("Load")) { string path = EditorUtility.OpenFilePanel("Load New Level", "", "txt"); if (path.Length != 0) { mCurrentMotive = Motive.Deserialize(path); } } EditorGUILayout.EndHorizontal(); }
public IActionResult Edit(int id) { Motive motive = _data.Motives.Get(id); ViewBag.Action = "Editar motivo"; return(View(motive)); }
public Motive Transposed(int t, int min, int max) { Motive newmotive = new Motive(this); newmotive.Transpose(t, min, max); return(newmotive); }
public Motive Transposed(int t) { Motive newmotive = new Motive(this); newmotive.Transpose(t); return(newmotive); }
public Motive Dilated(int about, int amount) { Motive newmotive = new Motive(this); newmotive.Dilate(about, amount); return(newmotive); }
public Motive Reversed() { Motive newmotive = new Motive(this); newmotive.Reverse(); return(newmotive); }
public Motive Inverted() { Motive newmotive = new Motive(this); newmotive.Invert(); return(newmotive); }
public IActionResult Edit(Motive motive) { IEnumerable <Motive> motives = _data.Motives.List(); IEnumerable <string> existingCarNames = from c in motives select c.Name; string key = nameof(Motive.Name); if (ModelState.GetFieldValidationState(key) == ModelValidationState.Valid) { if (motive.MotiveId == 0 && existingCarNames.Contains(motive.Name)) { ModelState.AddModelError(key, "Escolha outro nome"); } } if (ModelState.IsValid) { if (motive.MotiveId == 0) { _data.Motives.Insert(motive); } else { _data.Motives.Update(motive); } _data.Save(); return(RedirectToAction("List")); } else { ViewBag.Action = motive.MotiveId == 0 ? "Adicionar motivo" : "Editar motivo"; return(View("Edit", new Motive())); } }
public static TabiApiClient.Models.TrackMotive ToTrackMotiveMotiveApiModel(this Motive motive) { return(new TabiApiClient.Models.TrackMotive() { LocalTrackId = motive.TrackId, Motive = motive.Text, Timestamp = motive.Timestamp, }); }
public static TabiApiClient.Models.UserStopMotive ToUserStopMotiveApiModel(this Motive motive) { return(new TabiApiClient.Models.UserStopMotive() { LocalStopVisitId = motive.StopVisitId, Motive = motive.Text, Timestamp = motive.Timestamp, }); }
public static SimInfo.SimOccultInfo GetSimOccultInfo() { Sim sim = Sim.ActiveActor; if (sim == null) { return(new SimInfo.SimOccultInfo(Sims3.SimIFace.CAS.CASAgeGenderFlags.Human)); } if (sim.OccultManager == null) { return(new SimInfo.SimOccultInfo(Sims3.SimIFace.CAS.CASAgeGenderFlags.Human)); } SimInfo.SimOccultInfo info = new SimInfo.SimOccultInfo(sim.SimDescription.Species); if (sim.SimDescription.IsAlienEvolved) { AlienUtils.GetAlienOccultInfo(ref info); } if (sim.OccultManager.mOccultList != null) { foreach (OccultBaseClass occult in sim.OccultManager.mOccultList) { occult.UpdateSimOccultInfo(ref info); } info.OccultType = sim.OccultManager.CurrentOccultTypes; } if (sim.Motives != null) { if (sim.SimDescription.IsWitch) { Motive motive = sim.Motives.GetMotive(CommodityKind.MagicFatigue); if (motive != null) { info.MagicMotiveValue = -motive.UIValue; //Common.DebugNotify(delegate { return "MagicFatigue2: " + motive.UIValue; }); } } else if (sim.SimDescription.IsFairy) { Motive motive = sim.Motives.GetMotive(CommodityKind.AuraPower); if (motive != null) { info.MagicMotiveValue = motive.UIValue; //Common.DebugNotify(delegate { return "AuraPower2: " + motive.UIValue; }); } } } return(info); }
protected static void UpdateMotives(Sim sim) { try { if (sim == null) { return; } if (sim.Motives == null) { return; } if (sim.OccultManager == null) { return; } if (sim.SimDescription.IsMummy) { Motive motive = sim.Motives.GetMotive(CommodityKind.Bladder); if (motive != null) { motive.DisableMotive(); } motive = sim.Motives.GetMotive(CommodityKind.Energy); if (motive != null) { motive.DisableMotive(); } } if (sim.SimDescription.IsFrankenstein) { Motive motive = sim.Motives.GetMotive(CommodityKind.Hygiene); if (motive != null) { motive.DisableMotive(); } } if (sim.SimDescription.IsVampire) { Motive motive = sim.Motives.GetMotive(CommodityKind.Fatigue); if (motive != null) { motive.DisableMotive(); } } } catch (Exception e) { Common.Exception(sim, e); } }
/// <summary> /// Gibt ein Bild wieder frei /// </summary> /// <param name="imageId">ID des Bildes in der Datenbank</param> /// <returns>Void</returns> private void unlogImage(int imageId) { Motive bm = db.ImagesSet.OfType <Motive>().Where(p => p.Id == imageId).First(); bm.readlock = false; bm.writelock = false; db.SaveChanges(); }
protected void ForceSetMax(Motives ths, CommodityKind commodity) { Motive motive = ths.GetMotive(commodity); if ((motive != null) && (motive.Value != motive.Tuning.Max)) { motive.UpdateMotiveBuffs(ths.mSim, commodity, (int)motive.Tuning.Max); motive.mValue = motive.Tuning.Max; } }
public override Motive SaveViewModelToModel() { Motive initialModel = _motive; initialModel.TrackId = _motive.TrackId; initialModel.Text = Text; initialModel.Timestamp = DateTimeOffset.Now; return(initialModel); }
public override void Interrupt(Motive motive) { if (routine == null) { return; } Routines.Stop(routine); routine = null; }
public MotiveValue(MotiveID name, Motive value) { mName = Common.LocalizeEAString("Ui/Caption/HUD/MotivesPanel:Motive" + name.ToString()); if (value != null) { mValue = (int)value.Value; mExists = true; } }
protected override bool SaveViewModel() { if (_motiveSelectionViewModel.ShouldSave) { saved = true; Motive.Text = _motiveSelectionViewModel.SelectedMotiveOption.Id; Motive newMotive = Motive.SaveViewModelToModel(); _repoManager.MotiveRepository.Add(newMotive); } return(_motiveSelectionViewModel.ShouldSave); }
public void SetRestMotive(Motive motive) { if (motive.MotiveType() == Type.RestMotive) { m_EnergyScoreMotive = motive; } else { Debug.LogError("Rest Motive not assigned for LeaveMotive"); } }
public void Interrupt(Motive motive) { Buffer.isGameTurn = false; isActive = false; foreach (var activable in links) { activable.Deactivate(); } Events.BreakValueRelay <SpellBase, bool>(GameEvent.OnSpellUsed, OnSpellUsed); }
protected void Stop(Motive motive) { if (Target.IsBusy) { cachedMotive = motive; Target.onFree += DelayedStop; } else { End(motive); } }
public static void ConfirmAccuse(string CharacterAccused, string item1, string item2, Motive motive) { Debug.Log("Confirming Accuse"); if (CheckPlayerWin(CharacterAccused, item1, item2, motive)) { Application.LoadLevel("Framed" + CharacterAccused); } else { Application.LoadLevel("FramedPlayer"); } }
public MotiveValue(CommodityKind name, Motive value) { if (!Common.Localize("CommodityKind:" + name, false, new object[0], out mName)) { mName = name.ToString(); } if (value != null) { mValue = (int)value.Value; mExists = true; } }
public void Interrupt(Motive motive) { var handler = Repository.Get <RewardHandler>(References.Reward); handler.onHideStart -= OnHideStart; handler.onDone -= OnDone; if (IsBusy) { return; } handler.Hide(); }
public AbstractMotiveViewModel(Motive motive, IMotiveConfiguration motiveConfiguration) { _motive = motive ?? throw new ArgumentNullException(nameof(motive)); _motiveConfiguration = motiveConfiguration ?? throw new ArgumentNullException(nameof(motiveConfiguration)); ResetViewModel(); PropertyChanged += (sender, e) => { if (e.PropertyName == nameof(Text)) { OnPropertyChanged(nameof(ConvertedText)); } }; }
protected static void AlterDecay(Motive motive, bool freeze) { if (motive == null) { return; } if (freeze) { motive.FreezeDecay(true); } else { motive.RestoreDecay(); } }
public int?GetTotalDistancePerMotive(Motive motive) { QueryOptions <Ride> queryOptions = new QueryOptions <Ride> { Where = ride => ride.MotiveId == motive.MotiveId }; IEnumerable <Ride> rides = _data.Rides.List(queryOptions); int?totalDistance = 0; _helper.PopulateInitialMileage(rides); foreach (Ride ride in rides) { totalDistance += ride.GetDistance(); } return(totalDistance); }
private static bool CheckPlayerWin(string CharacterAccused, string item1, string item2, Motive motive) { bool accusedIsInList = false; if(mPlayerRef == null) { mPlayerRef = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MainCharacter>(); } foreach(NonPlayableCharacter character in Characters.Values) { if(character.CharacterSuspicion >= mPlayerRef.CharacterSuspicion - maxModifier && character.mCharacterName.ToString() == CharacterAccused) { Debug.Log(character.mCharacterName + " has more suspicion than the player"); if(!charSuspicion.ContainsKey(character)) charSuspicion.Add(character, character.CharacterSuspicion); if(!characters.ContainsKey(character.mCharacterName.ToString())) characters.Add(character.mCharacterName.ToString(), character.CharacterSuspicion); } } foreach(var scopedCharacters in charSuspicion) { if(scopedCharacters.Key.mCharacterName.ToString() == CharacterAccused) { accusedIsInList = true; Debug.Log(scopedCharacters.Key.mCharacterName + " is the person being framed"); accusedCharacter = scopedCharacters.Key; } } if(!accusedIsInList) return false; var charComponent = GameManager.Instance.Characters[CharacterAccused]; var npcComponent = charComponent as NonPlayableCharacter; if(npcComponent == null) return false; if(item1 == npcComponent.Item1.ToString() || item1 == npcComponent.Item2.ToString()) { Debug.Log(accusedCharacter.mCharacterName + ": matched the first item, 5 points!"); accusedCharacter.ModifySuspicion(item1Modifier); } else { mPlayerRef.ModifySuspicion(item1Modifier); } if(item2 == npcComponent.Item1.ToString() || item2 == npcComponent.Item2.ToString()) { Debug.Log(accusedCharacter.mCharacterName + ": matched the second item, 5 points!"); accusedCharacter.ModifySuspicion(item2Modifier); } else { mPlayerRef.ModifySuspicion(item2Modifier); } if(motive == npcComponent.mCharacterMotive) { Debug.Log(accusedCharacter.mCharacterName + ": matched the motive, 10 points!"); accusedCharacter.ModifySuspicion(motiveModifier); } else { mPlayerRef.ModifySuspicion(motiveModifier); } if(mPlayerRef.CharacterSuspicion < accusedCharacter.CharacterSuspicion) { return true; } else { return false; } }
//**************************************************************************** //**************************************************************************** void Start() { //mDoors = GameObject.FindGameObjectsWithTag("Door"); var body = gameObject.AddComponent<Rigidbody>(); body.isKinematic = true; body.useGravity = false; GameObject temp = GameObject.FindGameObjectWithTag("MainCamera"); if(temp != null) { characterRef = temp.GetComponentInChildren<MainCharacter>(); } base.Start(); mCharacterMotive = MotiveManager.GetMotive(mCharacterName); mConversationRef = gameObject.GetComponent<Conversation>(); //Debug.Log(gameObject.name + " Conversation status: " + mConversationRef); mNavController = gameObject.GetComponent<Navigation>(); GameManager.Instance.RegisterMotive(mCharacterName.ToString(),mCharacterMotive); GameManager.Instance.SpawnItem(Item1); GameManager.Instance.SpawnItem(Item2); mCaught1 = Conversation.LoadConvo(mCaughtItem1Convo); mCaught2 = Conversation.LoadConvo(mCaughtItem2Convo); mDefault = Conversation.LoadConvo(mDefaultConvo); DiarySpawner.SpawnDiary(mCharacterName.ToString()); Inputbase.Instance.OnActionButtonPressedHandle += StartConverstaion; mAnimationRef = GetComponentInChildren<Animation>(); if(gameObject.GetComponent<AccusePlayerInteraction>() != null) { mAnimationRef.Play(mIdleAnimation); } else mAnimationRef.Play(mWalkAnimation); //Debug.Log("Animation ref status: " + mAnimationRef); }
public void RegisterMotive(string NPCName, Motive motive) { if (!motives.ContainsKey(NPCName)) motives.Add(NPCName, motive); }
static void Init() { MotiveEditor window = GetWindow<MotiveEditor>(); window.maxSize = new Vector2(250,300); mCurrentMotive = new Motive(); }