void Awake() { IM = this; cRect = canvas.GetComponent <RectTransform>(); canvasSize = cRect.sizeDelta; canvasScale = cRect.localScale; mainInput = new MainPhaseInput(this); draftInput = new DraftPhaseInput(this); handDestInput = new HandDestPhaseInput(this); mulliganInput = new MulliganPhaseInput(this); activeInput = mainInput; oldActiveInput = mainInput; }
public static void Run(ICardInput input, ILocalized localizer) { if (QueryValidationHelper.IsReservedGuid(input.VersionCreatorId)) throw new InvalidOperationException(localizer.Get("InvalidOwner")); if (input.FrontSide != input.FrontSide.Trim()) throw new InvalidOperationException("Invalid front side: not trimmed"); if (input.FrontSide.Length < minFrontSideLength || input.FrontSide.Length > maxFrontSideLength) throw new RequestInputException(localizer.Get("InvalidFrontSideLength") + $" {input.FrontSide.Length}" + localizer.Get("MustBeBetween") + $" {minFrontSideLength} " + localizer.Get("And") + $" {maxFrontSideLength}"); if (input.FrontSideImageList.Count() > maxImageCountPerSide) throw new RequestInputException(localizer.Get("InvalidFrontSideImageCount") + $" {input.FrontSideImageList.Count()}" + localizer.Get("MustBeNotBeAvove") + $" {maxImageCountPerSide}"); if (input.BackSide != input.BackSide.Trim()) throw new InvalidOperationException("Invalid back side: not trimmed"); if ((input.BackSide.Length < minBackSideLength || input.BackSide.Length > maxBackSideLength) && !(input.BackSide.Length == 0 && input.BackSideImageList.Any())) throw new RequestInputException(localizer.Get("InvalidBackSideLength") + $" {input.BackSide.Length}" + localizer.Get("MustBeBetween") + $" {minBackSideLength} " + localizer.Get("And") + $" {maxBackSideLength}"); if (input.BackSideImageList.Count() > maxImageCountPerSide) throw new RequestInputException(localizer.Get("InvalidBackSideImageCount") + $" {input.BackSideImageList.Count()}" + localizer.Get("MustBeNotBeAvove") + $" {maxImageCountPerSide}"); if (input.AdditionalInfo != input.AdditionalInfo.Trim()) throw new InvalidOperationException("Invalid additional info: not trimmed"); if (input.AdditionalInfo.Length < minAdditionalInfoLength || input.AdditionalInfo.Length > maxAdditionalInfoLength) throw new RequestInputException(localizer.Get("InvalidAdditionalInfoLength") + $" {input.AdditionalInfo.Length}" + localizer.Get("MustBeBetween") + $" {minAdditionalInfoLength} " + localizer.Get("And") + $" {maxAdditionalInfoLength}"); if (input.AdditionalInfoImageList.Count() > maxImageCountPerSide) throw new RequestInputException(localizer.Get("InvalidAdditionalInfoImageCount") + $" {input.AdditionalInfoImageList.Count()}" + localizer.Get("MustBeNotBeAvove") + $" {maxImageCountPerSide}"); if (input.VersionDescription != input.VersionDescription.Trim()) throw new InvalidOperationException("Invalid VersionDescription: not trimmed"); if (input.VersionDescription.Length < MinVersionDescriptionLength || input.VersionDescription.Length > MaxVersionDescriptionLength) throw new RequestInputException(localizer.Get("InvalidVersionDescriptionLength") + $" {input.VersionDescription.Length}" + localizer.Get("MustBeBetween") + $" {MinVersionDescriptionLength} " + localizer.Get("And") + $" {MaxVersionDescriptionLength}"); var unionedImageLists = input.FrontSideImageList.Concat(input.BackSideImageList).Concat(input.AdditionalInfoImageList); if (unionedImageLists.GroupBy(guid => guid).Where(guid => guid.Count() > 1).Any()) throw new RequestInputException(localizer.Get("ImageDuplicated")); if (QueryValidationHelper.IsReservedGuid(input.LanguageId)) throw new RequestInputException(localizer.Get("InvalidInputLanguage")); if (input.Tags.Where(tag => QueryValidationHelper.IsReservedGuid(tag)).Any()) throw new RequestInputException(localizer.Get("InvalidTag")); if (input.UsersWithVisibility.Where(userWithVisibility => QueryValidationHelper.IsReservedGuid(userWithVisibility)).Any()) throw new RequestInputException(localizer.Get("InvalidUserWithVisibility")); if (!CardVisibilityHelper.CardIsVisibleToUser(input.VersionCreatorId, input.UsersWithVisibility)) throw new InvalidOperationException(localizer.Get("OwnerMustHaveVisibility")); }
protected virtual void Update() { RectUpdate(); //各フェイズ毎のタッチ処理 switch (Constants.BATTLE.GetTurnPhase()) { //ドラフト処理 case GamePhase.draft: activeInput = draftInput; break; //メイン処理 case GamePhase.main: activeInput = mainInput; break; //それ以外 case GamePhase.aligment: case GamePhase.coinTos: break; case GamePhase.mulligan: activeInput = mulliganInput; break; case GamePhase.start: case GamePhase.end: break; case GamePhase.handDest: activeInput = handDestInput; break; case GamePhase.gameEnd: default: return; } if (activeInput != oldActiveInput) { oldActiveInput.PhaseEnd(); activeInput.PhaseStart(); oldActiveInput = activeInput; } activeInput.InputUpdate(); //oldClick = cardOnClick; UpdateLongTap(); }
public static void Run(ICardInput input, IStringLocalizer localizer) { if (QueryValidationHelper.IsReservedGuid(input.VersionCreator.Id)) { throw new RequestInputException(localizer["InvalidOwner"].Value); } if (input.FrontSide != input.FrontSide.Trim()) { throw new InvalidOperationException("Invalid front side: not trimmed"); } if (input.FrontSide.Length < minFrontSideLength || input.FrontSide.Length > maxFrontSideLength) { throw new RequestInputException(localizer["InvalidFrontSideLength"] + $" {input.FrontSide.Length}" + localizer["MustBeBetween"] + $" {minFrontSideLength} " + localizer["And"] + $" {maxFrontSideLength}"); } if (input.FrontSideImageList.Count() > maxImageCountPerSide) { throw new RequestInputException(localizer["InvalidFrontSideImageCount"] + $" {input.FrontSideImageList.Count()}" + localizer["MustBeNotBeAvove"] + $" {maxImageCountPerSide}"); } if (input.BackSide != input.BackSide.Trim()) { throw new InvalidOperationException("Invalid back side: not trimmed"); } if ((input.BackSide.Length < minBackSideLength || input.BackSide.Length > maxBackSideLength) && !(input.BackSide.Length == 0 && input.BackSideImageList.Any())) { throw new RequestInputException(localizer["InvalidBackSideLength"] + $" {input.BackSide.Length}" + localizer["MustBeBetween"] + $" {minBackSideLength} " + localizer["And"] + $" {maxBackSideLength}"); } if (input.BackSideImageList.Count() > maxImageCountPerSide) { throw new RequestInputException(localizer["InvalidBackSideImageCount"] + $" {input.BackSideImageList.Count()}" + localizer["MustBeNotBeAvove"] + $" {maxImageCountPerSide}"); } if (input.AdditionalInfo != input.AdditionalInfo.Trim()) { throw new InvalidOperationException("Invalid additional info: not trimmed"); } if (input.AdditionalInfo.Length < minAdditionalInfoLength || input.AdditionalInfo.Length > maxAdditionalInfoLength) { throw new RequestInputException(localizer["InvalidAdditionalInfoLength"] + $" {input.AdditionalInfo.Length}" + localizer["MustBeBetween"] + $" {minAdditionalInfoLength} " + localizer["And"] + $" {maxAdditionalInfoLength}"); } if (input.AdditionalInfoImageList.Count() > maxImageCountPerSide) { throw new RequestInputException(localizer["InvalidAdditionalInfoImageCount"] + $" {input.AdditionalInfoImageList.Count()}" + localizer["MustBeNotBeAvove"] + $" {maxImageCountPerSide}"); } if (input.VersionDescription != input.VersionDescription.Trim()) { throw new InvalidOperationException("Invalid VersionDescription: not trimmed"); } if (input.VersionDescription.Length < minVersionDescriptionLength || input.VersionDescription.Length > maxVersionDescriptionLength) { throw new RequestInputException(localizer["InvalidVersionDescriptionLength"] + $" {input.VersionDescription.Length}" + localizer["MustBeBetween"] + $" {minVersionDescriptionLength} " + localizer["And"] + $" {maxVersionDescriptionLength}"); } var unionedImageLists = input.FrontSideImageList.Concat(input.BackSideImageList).Concat(input.AdditionalInfoImageList); if (unionedImageLists.GroupBy(guid => guid).Where(guid => guid.Count() > 1).Any()) { throw new RequestInputException(localizer["ImageDuplicated"].Value); } if (QueryValidationHelper.IsReservedGuid(input.LanguageId)) { throw new RequestInputException(localizer["InvalidInputLanguage"].Value); } if (input.Tags.Where(tag => QueryValidationHelper.IsReservedGuid(tag)).Any()) { throw new RequestInputException(localizer["InvalidTag"].Value); } if (input.UsersWithVisibility.Where(userWithVisibility => QueryValidationHelper.IsReservedGuid(userWithVisibility)).Any()) { throw new RequestInputException(localizer["InvalidUserWithVisibility"].Value); } if (input.UsersWithVisibility.Any() && !input.UsersWithVisibility.Any(userWithVisibility => userWithVisibility == input.VersionCreator.Id)) { //To be reviewed when we support card versions: I suspect we want visibility for all past owners throw new RequestInputException(localizer["OwnerMustHaveVisibility"].Value); } }