using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class ErrorProcessor:MonoBehaviour { [SerializeField] ErrorInfo[] errors = null; public void Process(int _error) { ErrorInfo info; if(FindError(_error,out info)) { switch(info.type) { case ErrorType.PopupTip: break; case ErrorType.DiamondLack: break; case ErrorType.GoldLack: break; case ErrorType.ItemLack: break; } } } bool FindError(int _error,out ErrorInfo _errorInFo) { var result = false; for(int i = 0;i < errors.Length;i++) { var error = errors[i]; if(error.error == _error) { _errorInFo = error; result = true; break; } } _errorInFo = new ErrorInfo(); return result; } [Serializable] public struct ErrorInfo { public int error; public ErrorType type; public string parameter; } public enum ErrorType { PopupTip, DiamondLack, GoldLack, ItemLack, } }