public ModelActions(ModelActions template) { if (template != null) { this.name = template.name; this.isBase = template.isBase; this.isActive = template.isActive; this.isStressed = template.isStressed; this.fisicoMulti = template.fisicoMulti; this.mentalMulti = template.mentalMulti; this.socialMulti = template.socialMulti; this.emotionalMulti = template.emotionalMulti; this.duration = template.duration; this.physic = template.physic; this.mental = template.mental; this.social = template.social; this.emotional = template.emotional; this.actionUse = template.actionUse; this.icon = template.icon; this.actionType = template.actionType; this.satisfaction = template.satisfaction; this.animationCode = template.animationCode; this.satisfactionCost = template.satisfactionCost; //this.chanceRate = template.chanceRate; } GeneradeResilience(); }
public void RefrashAddList(int refList) { daylistRef = refList; //ModelActions action = gmtl.GetListActionInDay(daylistRef); myaction = gmtl.GetListActionInDay(daylistRef); myicon.sprite = myaction.icon; //Debug.Log(myaction.name); myName.GetComponent <LanguageText>().ChangeInitialReference(myaction.name); name = myName.text = LocalizationManager.GetText(myaction.name); //name = myName.text = myaction.name; myDuration.gameObject.SetActive(TimeLineController.inEdit); if (myaction.actionType == ModelActions.ActionType.Challenger) { myDuration.gameObject.SetActive(false); satisfactionChallenger.text = String.Format("-{0:00}", myaction.satisfactionCost); } myDuration.value = myaction.duration / gmtl.durationScale; myProgress.gameObject.SetActive(!TimeLineController.inEdit); myTime.text = gmtl.GetStringHour(myaction.duration); float maxAllduration = GameManagerTimeline.maxHour - gmtl.DayDuration; gmtl.CallOnDayDurationChange(maxAllduration); myaction.GeneradeResilience(); SetResilienceImage(); }
private void PasteActions() { List <ModelActionEditor> paste = new List <ModelActionEditor>(); if (Clipboard.TryPaste(out paste)) { foreach (var item in paste) { if (item.IsSkillAction) { SkillActions.Add(item); } else { ModelActions.Add(item); } item.IsSelected = false; } Clipboard.Clear(); } else { EditorUtility.DisplayDialog("粘贴异常", "行为数据粘贴失败,或者无数据可张贴~~", "确定"); } }
public void SlideChangeHour() { myaction = gmtl.GetListActionInDay(daylistRef); if (GameManager.TutorialMode && TutorialManager.GetTutorialFase() == 25 && myDuration.value > 120 / gmtl.durationScale) { if (stoptutor == false) { stoptutor = true; TutorialPhase(); } } else if (myaction.actionType != ModelActions.ActionType.Challenger) { float diference = (myDuration.value * gmtl.durationScale) - myaction.duration; //Debug.Log(diference); myaction.duration = myDuration.value * gmtl.durationScale; myTime.text = gmtl.GetStringHour(myaction.duration); gmtl.DayDuration += diference; float maxAllduration = GameManagerTimeline.maxHour - gmtl.DayDuration; gmtl.CallOnDayDurationChange(maxAllduration); myaction.GeneradeResilience(); SetResilienceImage(); } }
private void SetResilienceImage(int idde = -1) { //GameManagerTimeline gmtl = GameManagerTimeline.GetInstance(); idde = (idde < 0) ? daylistRef : idde; ModelActions action = gmtl.GetListActionInDay(idde); imgPhysic.fillAmount = action.GetResilienceAction(.25f, action.physic, gmtl.resilienceMaxForSatisfation); imgMental.fillAmount = action.GetResilienceAction(.25f, action.mental, gmtl.resilienceMaxForSatisfation); imgSocial.fillAmount = action.GetResilienceAction(.25f, action.social, gmtl.resilienceMaxForSatisfation); imgEmotional.fillAmount = action.GetResilienceAction(.25f, action.emotional, gmtl.resilienceMaxForSatisfation); float tstress = action.GetStressResilienceAction(1, action.physic, gmtl.resilienceMaxForSatisfation); tstress += action.GetStressResilienceAction(1, action.mental, gmtl.resilienceMaxForSatisfation); tstress += action.GetStressResilienceAction(1, action.social, gmtl.resilienceMaxForSatisfation); tstress += action.GetStressResilienceAction(1, action.emotional, gmtl.resilienceMaxForSatisfation); imgStress.color = colorStress; imgStress.fillAmount = tstress; if (action.actionType == ModelActions.ActionType.Sleep) { float recovery = action.GetRecoveryStressSleepAction(gmtl.resilienceMaxForSatisfation); imgStress.color = colorRecovery; imgStress.fillAmount = recovery; //Debug.Log(recovery); } }
public void SetupButton(int idde) { ModelActions action = GameManager.GetInstance().GetTemplates(idde); name = action.name; namePreset.GetComponent <LanguageText>().ChangeInitialReference(action.name); //Debug.Log(LocalizationManager.GetText(action.name)); namePreset.text = LocalizationManager.GetText(action.name); iconPreset.sprite = action.icon; }
public ModelObject(ushort id, ushort tid, ushort parentid) { Id = id; Tid = tid; Parent = parentid; ModelChildren = new ModelChildren(); ModelActions = new ModelActions(); ModelRelations = new ModelRelations(); ModelProperties = new ModelProperties(); }
private void ConfigureChallengers(ModelActions challenger, Transform parent) { // tem tempo paara adicionar na linha do tempo //TODO: Fazer ativar as animações para os stress. challenger.duration = (challenger.duration > (GameManagerTimeline.maxHour - gmtl.DayDuration)) ? GameManagerTimeline.maxHour - gmtl.DayDuration : challenger.duration; gmtl.AddActionInList(challenger); AddActionInParent(parent); gmtl.DayDuration = gmtl.GetListActionInDay().Sum(action => action.duration) + challenger.duration; challenger.actionUse += 1; actulChallegerInDay += 1; //Debug.Log("Arrumou Problema"); }
public ModelActionConfigEditor(string path) { _path = path; _modelActionCfg = XmlUtil.Deserialize(path, typeof(ModelActionConfig)) as ModelActionConfig; foreach (var item in _modelActionCfg.ModelActionList) { var action = new ModelActionEditor(this, item, false); action.ActState = ModelActionEditor.ActionState.New; ModelActions.Add(action); } foreach (var item in _modelActionCfg.SkillActionList) { var action = new ModelActionEditor(this, item, true); action.ActState = ModelActionEditor.ActionState.New; SkillActions.Add(action); } }
public void OnDrop(PointerEventData eventData) { inEdit = true; Presets_Buttons preset = eventData.pointerDrag.GetComponent <Presets_Buttons>(); if (preset != null && GameManager.TutorialMode && preset.presetID != 1) { TutorialManager.ToggleImagePanel(true); TutorialManager.ToggleMessage(true); string message = LocalizationManager.GetText("Let's try the food first!"); TutorialManager.GetInstance().messagemBallon.GetComponentInChildren <TextAnimated>().SetMessage(message, FinishCallbak); return; } if (preset != null && GameManagerTimeline.maxHour - gmtl.DayDuration > 0) { if (GameManager.TutorialMode && preset.presetID == 1) { TutorialManager.ToggleImagePanel(true); TutorialManager.ToggleMessage(true); TutorialManager.pauseTutorial = false; string message = LocalizationManager.GetText("Very well now let's set the time for our meal"); TutorialManager.GetInstance().messagemBallon.GetComponentInChildren <TextAnimated>().SetMessage(message, TutorialManager.GetInstance().FinishCallbak); } ModelActions action = new ModelActions(GameManager.GetInstance().GetTemplates(preset.presetID)); action.duration = gmtl.GetDuration(action.duration); // corrige o valor de acordo com o salto; float dayduration = gmtl.GetListActionInDay().Sum(x => x.duration) + action.duration; //Debug.Log(alltime); if (GameManagerTimeline.maxHour - gmtl.DayDuration > 0) { gmtl.DayDuration = dayduration; //action.modelId = gmtl.CountDaylist(); gmtl.AddActionInList(action); AddActionInParent(contentEdit); gmtl.CallEventAddActionInList(contentEdit); } } }
private void AddBaseModelAction(string name) { var baseModel = HomeConfigPreview.Instance.GetModelEditor(name); var modelDict = GetModelActionDict(); foreach (var item in baseModel.ModelActions) { if (modelDict.ContainsKey(item.ActionName)) { modelDict[item.ActionName].ActState = modelDict[item.ActionName].Equals(item) ? ModelActionEditor.ActionState.Inherit : ModelActionEditor.ActionState.Override; } else { var action = new ModelActionEditor(item); action.ActState = ModelActionEditor.ActionState.Inherit; ModelActions.Add(action); } } var skillDict = GetModelActionDict(); foreach (var item in baseModel.SkillActions) { if (skillDict.ContainsKey(item.ActionName)) { skillDict[item.ActionName].ActState = skillDict[item.ActionName].Equals(item) ? ModelActionEditor.ActionState.Inherit : ModelActionEditor.ActionState.Override; } else { var action = new ModelActionEditor(item); action.ActState = ModelActionEditor.ActionState.Inherit; SkillActions.Add(action); } } }
/// <summary> /// Another overload for RunActions which runs the actions specified. /// </summary> /// <param name="actions"></param> public void RunScenario(ModelActions actions) { //Delegate foreach(ModelAction action in actions ) this.ExecuteAction(action); }
protected ModelActions GetPossibleActions(ModelActions totalactions) { //Loop through all actions, specified ModelActions possibleactions = new ModelActions(); foreach(ModelAction action in totalactions) { //Ignore Disabled actions if(action.Weight == 0 || action.Disabled) continue; //Ignore CallLimit/CallOnce actions that have already been called (max times) if(action.Accessed >= action.CallLimit) continue; //Note: CallFirst and CallLast imply CallOnce if(action.Accessed>0 && (action.CallFirst || action.CallLast)) continue; //Ignore Actions, that return Models when were over the limit of those models Type returntype = action.Method.ReturnType; if(!returntype.IsPrimitive && typeof(Model).IsAssignableFrom(returntype) && returntype != typeof(Model)) { Models found = (Models)this.Models.FindType(returntype).FindFlag((int)ModelItemFlags.Disabled, false); if(found.Count >= found.MaxInstances) continue; } //Determine if Requirements meet ModelRequirement failedrequirement = null; bool matched = MeetsRequirements(action.Requirements, out failedrequirement); if(matched) { //Requirements met, action can be called possibleactions.Add(action); } else { //Requirements not met, action can't be called //Unless the user wants this to be called, when the requirements aren't met if(this.InvalidActions && failedrequirement != null && failedrequirement.Throws) { //Note: We clone the action, and set the expected exception, just as if //it were an invalid action from the start. We also set the weight of the //invalid action, to the weight of the requirement, so it's not weighted //the same as the (positive) version that's specified at the action level ModelAction invalidaction = (ModelAction)action.Clone(); invalidaction.Exception = failedrequirement.Exception; invalidaction.ExceptionId = failedrequirement.ExceptionId; invalidaction.Weight = failedrequirement.Weight; possibleactions.Add(invalidaction); } } } possibleactions.SortByWeightDesc(); //Sort all actions, across models return possibleactions; }
//Methods //FIXME: should this be public? It is difficult to extend the behavior of the engine without //hosting the extension in the same assembly, unless we do this. internal ModelActions GetPossibleActions() { //Default - exclude: invalid, callbefore, callafter, calllast, which are handled seperatly. ModelActionFlags exclude = ModelActionFlags.CallBefore | ModelActionFlags.CallAfter | ModelActionFlags.CallLast; if(!this.InvalidActions) exclude |= (ModelActionFlags)ModelItemFlags.Invalid; //Loop through all models ModelActions totalactions = new ModelActions(); foreach(Model model in this.Models) { //Ignore disabled models if(model.Weight == 0 || model.Disabled) continue; totalactions.Add(model.Actions.FindFlag(exclude, false)); } //Delegate return this.GetPossibleActions(totalactions); }
public void AddActionToList(ModelActions template) { listActions.Add(new ModelActions(template)); }
public void AddActionInList(ModelActions action) { listActionInDay.Add(action); }