public void CreateAction(ActionInformationContent actionInformationContent, GameObject actionObj = null) { ActionNotificationUI instance = Instantiate(actionUIPrefab, actionUIParent); instance.Refresh(GetActionDataBasedOnActionInformation(actionInformationContent, actionObj), UILifeTime); Debug.Log("Created action: " + actionInformationContent, actionObj); }
ActionData GetActionDataBasedOnActionInformation(ActionInformationContent actionInformationContent, GameObject actionObj) { switch (actionInformationContent) { case ActionInformationContent.PeaceDeclared: return(new ActionData(GetColorBasedOnActionType(ActionType.GoodInfo), "Made peace!", actionObj)); case ActionInformationContent.WarDeclared: return(new ActionData(GetColorBasedOnActionType(ActionType.BadInfo), "War has been declared!", actionObj)); case ActionInformationContent.PlayerBuildingCaptured: return(new ActionData(GetColorBasedOnActionType(ActionType.BadInfo), "Your building has been captured!", actionObj)); case ActionInformationContent.PlayerWorldAgentDestroyed: return(new ActionData(GetColorBasedOnActionType(ActionType.BadInfo), "Your general has been destroyed!", actionObj)); default: return(new ActionData(Color.white, "", null)); } }