Ejemplo n.º 1
0
    Texture GestureToTexture(UserInputType gestureType)
    {
        switch (gestureType)
        {
        case UserInputType.Button_Right_Claw_Tap:
            return(RightClaw_Tap);

        case UserInputType.Button_Right_Claw_Hold:
            return(RightClaw_Hold);

        case UserInputType.Button_Left_Claw_Tap:
            return(LeftClaw_Tap);

        case UserInputType.Button_Left_Claw_Hold:
            return(LeftClaw_Hold);

        case UserInputType.Button_Dual_Claw_Tap:
            return(DualClaw_Tap);

        case UserInputType.Button_Dual_Claw_Hold:
            return(DualClaw_Hold);

        default:
            return(RightClaw_Tap);
        }
    }
        /// <summary>
        /// Return view to update a user input
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult UpdateUserInput(UserInputType type, int id)
        {
            IUserInput input;

            switch (type)
            {
            case UserInputType.Text:
                input = _portfolioService.GetTextInput(UserId, id);
                break;

            case UserInputType.Selection:
                input = _portfolioService.GetSelectionInput(UserId, id);
                break;

            case UserInputType.ScriptedSelection:
                input = _portfolioService.GetScriptedSelectionInput(UserId, id);

                break;

            default:                     //need a default
                input = new TextInputDto();
                break;
            }
            //input.ServiceOptionId = id;
            UserInputModel model = new UserInputModel
            {
                InputType = type,
                UserInput = input,
                Action    = "Update"
            };

            return(View("EditUserInput", model));
        }
        /// <summary>
        /// Returns View to add form of corresponding type
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public ActionResult AddUserInput(UserInputType type)
        {
            UserInputModel model = new UserInputModel();
            IUserInput     input;

            switch (type)
            {
            case UserInputType.Text:
                input = new TextInputDto();
                break;

            case UserInputType.ScriptedSelection:
                input = new ScriptedSelectionInputDto();
                break;

            case UserInputType.Selection:
                input = new SelectionInputDto {
                    Delimiter = ","
                };                                                                         //set the default to comma
                break;

            default:                     //need a default
                input = null;            //null is ok, razor will handle
                break;
            }

            model.InputType = type;
            model.UserInput = input;
            model.Action    = "Add";

            return(View("EditUserInput", model));
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Gets the combat by token. If no prefab matched comboCombat can be found, return default combat.
    /// For example : there are two combo combat defined in prefab: tap + tap + tap + slice (1110) , slice + tap + tap + slice (1001)
    ///               then parameter token = 111 = returned 1110
    ///               parameter token = 1001 = return 1001
    ///               parameter token = 101 = return default combat of gesture type = tap , because no prefab combat can be found
    /// </summary>
    /// <param name="playerComboToken">the player combo token</param>
    /// <param name="gestureType">gesture type</param>
    /// <param name="tokenMatched">output, indicate if the token matched to a prefab combat</param>
    /// <param name="IsLastCombat">output, indicated if the matched combat is the last combat in combo</param>
    /// <returns></returns>
    private PredatorCombatData GetComboCombatByToken(string playerComboToken, UserInputType gestureType, out bool tokenMatched, out bool IsLastCombat)
    {
        PredatorComboCombat comboCombat = null;

        IsLastCombat = false;
        //Search matched prefab combo combat, by playerCombatToken
        foreach (string prefabComboTokenKey in ComboCombatTokenDict.Keys)
        {
            if (prefabComboTokenKey.StartsWith(playerComboToken) && prefabComboTokenKey.Length >= playerComboToken.Length)
            {
                comboCombat  = ComboCombatTokenDict [prefabComboTokenKey];
                IsLastCombat = prefabComboTokenKey.Length == playerComboToken.Length;
                break;
            }
        }
        //If no matched combo combat is found, return the default combat
        if (comboCombat == null)
        {
            tokenMatched = false;
            return(GetDefaultCombat(gestureType));
        }
        else
        {
            tokenMatched = true;
            try{
                return(comboCombat.combat [playerComboToken.Length - 1]);
            }
            catch (Exception exc)
            {
                Debug.LogError(exc);
                return(null);
            }
        }
    }
Ejemplo n.º 5
0
 public UserInputData(UserInputType _Type, Vector2?direction, float _StartTime, float _EndTime)
 {
     Type             = _Type;
     gestureDirection = direction;
     StartTime        = _StartTime;
     EndTime          = _EndTime;
 }
Ejemplo n.º 6
0
 void NewHint(UserInputType PlayerInputType)
 {
     if(PlayerCombatList.Count == MaxCount)
     {
         PlayerCombatList.Clear();
     }
     PlayerCombatList.Add(PlayerInputType);
 }
Ejemplo n.º 7
0
 void NewHint(UserInputType PlayerInputType)
 {
     if (PlayerCombatList.Count == MaxCount)
     {
         PlayerCombatList.Clear();
     }
     PlayerCombatList.Add(PlayerInputType);
 }
Ejemplo n.º 8
0
 public override void CreateUserInputLogData(UserInputType type, string message)
 {
     Id            = Guid.NewGuid().ToString();
     Time          = DateTime.Now;
     LogType       = LogDataType.UserInput;
     UserInputType = type;
     Message       = message;
     FormatShortString();
     FormatLongString();
 }
Ejemplo n.º 9
0
 void OnGUI()
 {
     //From left to right
     for (int i = 0; i < PlayerCombatList.Count; i++)
     {
         int           GridSpaceCount = MaxCount + 1;
         Rect          area1          = new Rect(Screen.width - width * (GridSpaceCount - i), 0 + height, width, height);
         UserInputType gestureType    = PlayerCombatList[i];
         GUI.DrawTexture(area1, GestureToTexture(gestureType), ScaleMode.ScaleToFit, true);
     }
 }
Ejemplo n.º 10
0
    /// <summary>
    /// Given a current combo string token, predicts what player taps can perform the next matched combo.
    /// This function is used to hint player, that clicks what button can trigger the next matched combocombat.
    /// </summary>
    UserInputType[] PredictNextMatchedCombo(string currentToken)
    {
        List <UserInputType> nextUserInputType = new List <UserInputType>();

        foreach (PredatorComboCombat comboCombat in this.ComboCombats)
        {
            if (comboCombat.token.StartsWith(currentToken) && comboCombat.token.Length > currentToken.Length)
            {
                string        nextCombatToken = comboCombat.token[currentToken.Length].ToString();
                UserInputType type            = (UserInputType)Enum.Parse(typeof(UserInputType), nextCombatToken);
                nextUserInputType.Add(type);
//				Debug.Log("Found input:" + type.ToString());
            }
        }
        return(nextUserInputType.ToArray());
    }
        /// <summary>
        /// Show details of a user input
        /// </summary>
        /// <param name="type">input type</param>
        /// <param name="id">id of input</param>
        /// <returns></returns>
        public ActionResult ShowUserInput(UserInputType type = UserInputType.Text, int id = 0)
        {
            var model = new UserInputModel {
                InputType = type
            };
            IUserInput input;

            if (id > 0)
            {
                try
                {
                    switch (type)
                    {
                    case UserInputType.Text:
                        input = _portfolioService.GetTextInput(UserId, id);
                        break;

                    case UserInputType.ScriptedSelection:
                        input = _portfolioService.GetScriptedSelectionInput(UserId, id);
                        break;

                    case UserInputType.Selection:
                        input = _portfolioService.GetSelectionInput(UserId, id);

                        break;

                    default:                             //need a default
                        input = new TextInputDto();
                        break;
                    }
                }
                catch (Exception exception)
                {
                    TempData["MessageType"] = WebMessageType.Failure;
                    TempData["Message"]     = $"Failed to retreive user input, error: {exception.Message}";
                    input = new TextInputDto();                     //some default where id = 0
                }
            }
            else
            {
                input = new TextInputDto();                 //some default where id = 0
            }
            //input.ServiceOptionId = id;
            model.UserInput = input;

            return(View("ShowUserInput", model));
        }
        public ActionResult GetUserInputs(UserInputType type = UserInputType.Text, int id = 0)
        {
            UserInputsLinkListModel itemList = new UserInputsLinkListModel
            {
                SelectedInputId   = id,
                SelectedInputType = type,
                Action            = "ShowUserInput"
            };

            List <Tuple <UserInputType, int, string> > items = new List <Tuple <UserInputType, int, string> >();       //for the model

            try
            {
                var textInputs      = _portfolioService.GetTextInputs(UserId);            //store temporarily to check for nulls after
                var selectionInputs = _portfolioService.GetSelectionInputs(UserId);
                var scriptedInputs  = _portfolioService.GetScriptedSelectionInputs(UserId);
                if (textInputs != null)                 //
                {
                    items.AddRange(from s in textInputs
                                   select new Tuple <UserInputType, int, string>(UserInputType.Text, s.Id, s.DisplayName));
                }
                if (textInputs != null)
                {
                    items.AddRange(from s in selectionInputs
                                   select new Tuple <UserInputType, int, string>(UserInputType.Selection, s.Id, s.DisplayName));
                }
                if (textInputs != null)
                {
                    items.AddRange(from s in scriptedInputs
                                   select new Tuple <UserInputType, int, string>(UserInputType.ScriptedSelection, s.Id, s.DisplayName));
                }
            }
            catch (Exception exception)
            {
                TempData["MessageType"] = WebMessageType.Failure;
                TempData["Message"]     = $"Failed retrieving user inputs {exception.Message}";
            }

            itemList.Items = items.OrderBy(t => t.Item3);

            return(View("PartialViews/UserInputsLinkList", itemList));
        }
Ejemplo n.º 13
0
    /// <summary>
    /// Return the default left/right/dual claw combat.
    /// </summary>
    private PredatorCombatData GetDefaultCombat(UserInputType InputType)
    {
        switch (InputType)
        {
        case UserInputType.Button_Left_Claw_Tap:
        case UserInputType.Button_Left_Claw_Hold:
            return(DefaultCombat_LeftClaw);

        case UserInputType.Button_Right_Claw_Tap:
        case UserInputType.Button_Right_Claw_Hold:
            return(DefaultCombat_RightClaw);

        case UserInputType.Button_Dual_Claw_Hold:
        case UserInputType.Button_Dual_Claw_Tap:
            return(DefaultCombat_DualClaw);

        default:
            return(null);
        }
    }
        /// <summary>
        /// First step of deleting a user input
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult ConfirmDeleteUserInput(UserInputType type, int id)
        {
            ConfirmDeleteModel model = new ConfirmDeleteModel {
                Type = type, Id = id
            };

            model.DeleteAction = "DeleteUserInput";
            model.ReturnAction = "ShowUserInput";

            IUserInput input = null;

            try
            {
                switch (type)
                {
                case UserInputType.Text:
                    input = _portfolioService.GetTextInput(UserId, id);
                    break;

                case UserInputType.Selection:
                    input = _portfolioService.GetSelectionInput(UserId, id);
                    break;

                case UserInputType.ScriptedSelection:
                    input = _portfolioService.GetScriptedSelectionInput(UserId, id);
                    break;
                }
            }
            catch (Exception exception)
            {
                TempData["MessageType"] = WebMessageType.Failure;                 //return incomplete data with an error message
                TempData["Message"]     = $"Failed to find user input, error: {exception.Message}";
                return(View(model));
            }
            if (input != null)
            {
                model.Name = input.DisplayName;
            }

            return(View(model));
        }
Ejemplo n.º 15
0
    Texture GestureToTexture(UserInputType gestureType)
    {
        switch(gestureType)
        {
        case UserInputType.Button_Right_Claw_Tap:
            return RightClaw_Tap;
        case UserInputType.Button_Right_Claw_Hold:
            return RightClaw_Hold;
        case UserInputType.Button_Left_Claw_Tap:
            return LeftClaw_Tap;
        case UserInputType.Button_Left_Claw_Hold:
            return LeftClaw_Hold;
        case UserInputType.Button_Dual_Claw_Tap:
            return DualClaw_Tap;
        case UserInputType.Button_Dual_Claw_Hold:
            return DualClaw_Hold;

        default:
            return RightClaw_Tap;
        }
    }
Ejemplo n.º 16
0
        protected override void Seed(HM1Context context)
        {
            UserInputType dtText = new UserInputType()
            {
                Description = "Text", Code = "TEXT"
            };
            UserInputType dtWholeNumber = new UserInputType()
            {
                Description = "WholeNumber", Code = "INT"
            };
            UserInputType dtDecimal = new UserInputType()
            {
                Description = "Currency", Code = "CURRENCY"
            };
            UserInputType dtPercentage = new UserInputType()
            {
                Description = "Percentage", Code = "PCT"
            };
            UserInputType dtDate = new UserInputType()
            {
                Description = "Date", Code = "DATE"
            };
            UserInputType dtList = new UserInputType()
            {
                Description = "List", Code = "LIST"
            };
            UserInputType dtYear = new UserInputType()
            {
                Description = "Year", Code = "YEAR"
            };
            UserInputType dtBoolean = new UserInputType()
            {
                Description = "Boolean", Code = "BOOL"
            };

            context.UserInputTypes.Add(dtText);
            context.UserInputTypes.Add(dtWholeNumber);
            context.UserInputTypes.Add(dtDecimal);
            context.UserInputTypes.Add(dtPercentage);
            context.UserInputTypes.Add(dtDate);
            context.UserInputTypes.Add(dtList);
            context.UserInputTypes.Add(dtYear);
            context.UserInputTypes.Add(dtBoolean);


            var jtGeneral = new JournalType()
            {
                Name = "General", Code = "GEN"
            };
            var jtSplitExpense = new JournalType()
            {
                Name = "Split Expense", Code = "SEXP"
            };

            context.JournalTypes.Add(jtGeneral);
            context.JournalTypes.Add(jtSplitExpense);
            context.JournalTypes.Add(new JournalType()
            {
                Name = "Payment", Code = "PAY"
            });


            jtGeneral.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Defined Amount", PrimaryFactorCode = "AMT", SecondaryFactorCode = null
            });
            jtGeneral.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Percentage of ledger account", PrimaryFactorCode = "PERC", SecondaryFactorCode = "LEDGER"
            });


            jtSplitExpense.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Defined Amount", PrimaryFactorCode = "AMT", SecondaryFactorCode = null
            });
            jtSplitExpense.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Participation", PrimaryFactorCode = "PART", SecondaryFactorCode = "AMT"
            });


            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "Defined Amount", IsDailyCalc = false, IsDefinedAmount = true, IsPercentage = false, OfContextParameter = false, OfCoveragePremium = false, OfLedgerAccount = false });
            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "% of Coverage Premium", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = false, OfCoveragePremium = true, OfLedgerAccount = false });
            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "% of Ledger Account", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = false, OfCoveragePremium = false, OfLedgerAccount = true });
            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "% of Contextual Parameter", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = true, OfCoveragePremium = false, OfLedgerAccount = false });



            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "CA", Name = "Current Asset", IsAsset = true, IsCurrent = true, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "NCA", Name = "Non-Current Asset", IsAsset = true, IsCurrent = false, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "CL", Name = "Current Liability", IsLiability = true, IsCurrent = true, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "NCL", Name = "Non-Current Liability", IsLiability = true, IsCurrent = false, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "E", Name = "Expense", IsExpense = true, IsCurrent = true, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "I", Name = "Income", IsIncome = true, IsCurrent = true, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "D", Name = "Debtors", IsAsset = true, IsDebtor = true, IsCurrent = true, CreditPositive = false
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "C", Name = "Creditors", IsLiability = true, IsCredior = true, IsCurrent = true, CreditPositive = true
            });
            context.LedgerAccountTypes.Add(new LedgerAccountType()
            {
                Code = "EQ", Name = "Equity", IsEquity = true, CreditPositive = true
            });

            context.Regions.Add(new Region()
            {
                Code = "BC", Name = "British Columbia"
            });

            context.Ledgers.Add(new Ledger()
            {
                Code = "FIN", Name = "Financial Ledger"
            });

            base.Seed(context);
        }
Ejemplo n.º 17
0
        public static List <LogInfo> UserInput(EngineState s, CodeCommand cmd)
        {
            List <LogInfo> logs = new List <LogInfo>();

            Debug.Assert(cmd.Info.GetType() == typeof(CodeInfo_UserInput));
            CodeInfo_UserInput info = cmd.Info as CodeInfo_UserInput;

            UserInputType type = info.Type;

            switch (type)
            {
            case UserInputType.DirPath:
            case UserInputType.FilePath:
            {
                Debug.Assert(info.SubInfo.GetType() == typeof(UserInputInfo_DirFile));
                UserInputInfo_DirFile subInfo = info.SubInfo as UserInputInfo_DirFile;

                string initPath     = StringEscaper.Preprocess(s, subInfo.InitPath);
                string selectedPath = initPath;
                if (type == UserInputType.FilePath)
                {
                    string filter   = "All Files|*.*";
                    string initFile = Path.GetFileName(initPath);
                    if (initFile.StartsWith("*.", StringComparison.Ordinal) || initFile.Equals("*", StringComparison.Ordinal))
                    {         // If wildcard exists, apply to filter.
                        string ext = Path.GetExtension(initFile);
                        if (1 < ext.Length && ext.StartsWith(".", StringComparison.Ordinal))
                        {
                            ext = ext.Substring(1);
                        }
                        filter = $"{ext} Files|{initFile}";
                    }

                    Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog()
                    {
                        Filter           = filter,
                        InitialDirectory = Path.GetDirectoryName(initPath),
                    };

                    if (dialog.ShowDialog() == true)
                    {
                        selectedPath = dialog.FileName;
                        logs.Add(new LogInfo(LogState.Success, $"File path [{selectedPath}] was chosen by user"));
                    }
                    else
                    {
                        logs.Add(new LogInfo(LogState.Error, "File path was not chosen by user"));
                        return(logs);
                    }
                }
                else
                {
                    VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog()
                    {
                        SelectedPath = initPath,
                    };

                    bool failure = false;
                    Application.Current.Dispatcher.Invoke(() =>
                        {
                            if (dialog.ShowDialog(Application.Current.MainWindow))
                            {
                                selectedPath = dialog.SelectedPath;
                                logs.Add(new LogInfo(LogState.Success, $"Directory path [{selectedPath}] was chosen by user"));
                            }
                            else
                            {
                                logs.Add(new LogInfo(LogState.Error, "Directory path was not chosen by user"));
                                failure = true;
                            }
                        });
                    if (failure)
                    {
                        return(logs);
                    }
                }

                List <LogInfo> varLogs = Variables.SetVariable(s, subInfo.DestVar, selectedPath);
                logs.AddRange(varLogs);
            }
            break;

            default:     // Error
                throw new InvalidCodeCommandException($"Wrong UserInputType [{type}]");
            }

            return(logs);
        }
    /// <summary>
    /// Return the default left/right/dual claw combat.
    /// </summary>
    private PredatorCombatData GetDefaultCombat(UserInputType InputType)
    {
        switch (InputType) {
        case UserInputType.Button_Left_Claw_Tap:
        case UserInputType.Button_Left_Claw_Hold:
            return DefaultCombat_LeftClaw;

        case UserInputType.Button_Right_Claw_Tap:
        case UserInputType.Button_Right_Claw_Hold:
            return DefaultCombat_RightClaw;

        case UserInputType.Button_Dual_Claw_Hold:
        case UserInputType.Button_Dual_Claw_Tap:
            return DefaultCombat_DualClaw;
        default:
            return null;
        }
    }
 /// <summary>
 /// Gets the combat by token. If no prefab matched comboCombat can be found, return default combat.
 /// For example : there are two combo combat defined in prefab: tap + tap + tap + slice (1110) , slice + tap + tap + slice (1001)
 ///               then parameter token = 111 = returned 1110
 ///               parameter token = 1001 = return 1001
 ///               parameter token = 101 = return default combat of gesture type = tap , because no prefab combat can be found
 /// </summary>
 /// <param name="playerComboToken">the player combo token</param>
 /// <param name="gestureType">gesture type</param>
 /// <param name="tokenMatched">output, indicate if the token matched to a prefab combat</param>
 /// <param name="IsLastCombat">output, indicated if the matched combat is the last combat in combo</param>
 /// <returns></returns>
 private PredatorCombatData GetComboCombatByToken(string playerComboToken, UserInputType gestureType, out bool tokenMatched, out bool IsLastCombat)
 {
     PredatorComboCombat comboCombat = null;
     IsLastCombat = false;
     //Search matched prefab combo combat, by playerCombatToken
     foreach (string prefabComboTokenKey in ComboCombatTokenDict.Keys) {
         if (prefabComboTokenKey.StartsWith (playerComboToken) && prefabComboTokenKey.Length >= playerComboToken.Length) {
             comboCombat = ComboCombatTokenDict [prefabComboTokenKey];
             IsLastCombat = prefabComboTokenKey.Length == playerComboToken.Length;
             break;
         }
     }
     //If no matched combo combat is found, return the default combat
     if (comboCombat == null) {
         tokenMatched = false;
         return GetDefaultCombat (gestureType);
     } else {
         tokenMatched = true;
         try{
            return comboCombat.combat [playerComboToken.Length - 1];
         }
         catch(Exception exc)
         {
             Debug.LogError(exc);
             return null;
         }
     }
 }
Ejemplo n.º 20
0
        public override void CreateUserInputLogData(UserInputType type, string message)
        {
            LogType = LogDataType.UserInput;

            LongLogMessage = message + "\n===============================================================================\n";
        }
Ejemplo n.º 21
0
        private void RecursiveFindCodeSection(IReadOnlyList <CodeCommand> codes, List <LogInfo> logs)
        {
            string targetCodeSection      = null;
            string targetInterfaceSection = null;

            foreach (CodeCommand cmd in codes)
            {
                switch (cmd.Type)
                {
                    #region Check CodeSections
                case CodeType.If:
                {
                    CodeInfo_If info = cmd.Info.Cast <CodeInfo_If>();

                    if (info.Condition.Type == BranchConditionType.ExistSection)
                    {
                        // For recursive section call
                        // Ex) If,ExistSection,%ScriptFile%,DoWork,Run,%ScriptFile%,DoWork
                        if (info.Condition.Arg1.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                            info.Embed.Type == CodeType.Run || info.Embed.Type == CodeType.RunEx || info.Embed.Type == CodeType.Exec)
                        {
                            CodeInfo_RunExec subInfo = info.Embed.Info.Cast <CodeInfo_RunExec>();
                            if (subInfo.ScriptFile.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase))
                            {
                                if (info.Condition.Arg2.Equals(subInfo.SectionName, StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }
                            }
                        }
                    }

                    RecursiveFindCodeSection(info.Link, logs);
                }
                break;

                case CodeType.Else:
                {
                    CodeInfo_Else info = cmd.Info.Cast <CodeInfo_Else>();

                    RecursiveFindCodeSection(info.Link, logs);
                }
                break;

                case CodeType.Run:
                case CodeType.Exec:
                case CodeType.RunEx:
                {
                    CodeInfo_RunExec info = cmd.Info.Cast <CodeInfo_RunExec>();

                    // CodeValidator does not have Variable information, so just check with predefined literal
                    if (info.ScriptFile.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                        !CodeParser.StringContainsVariable(info.SectionName))
                    {
                        targetCodeSection = info.SectionName;
                    }
                }
                break;

                case CodeType.Loop:
                case CodeType.LoopLetter:
                case CodeType.LoopEx:
                case CodeType.LoopLetterEx:
                {
                    CodeInfo_Loop info = cmd.Info.Cast <CodeInfo_Loop>();

                    if (info.Break)
                    {
                        continue;
                    }

                    // CodeValidator does not have Variable information, so just check with predefined literal
                    if (info.ScriptFile.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                        !CodeParser.StringContainsVariable(info.SectionName))
                    {
                        targetCodeSection = info.SectionName;
                    }
                }
                break;

                case CodeType.UserInput:
                {
                    CodeInfo_UserInput info = cmd.Info.Cast <CodeInfo_UserInput>();

                    UserInputType type = info.Type;
                    switch (type)
                    {
                    case UserInputType.DirPath:
                    case UserInputType.FilePath:
                    {
                        UserInputInfo_DirFile subInfo = info.SubInfo.Cast <UserInputInfo_DirFile>();

                        if (info.Type == UserInputType.FilePath)
                        {                 // Select File
                            if (subInfo.Filter != null)
                            {
                                string filter = StringEscaper.Unescape(subInfo.Filter);
                                if (StringEscaper.IsFileFilterValid(filter) == false)
                                {
                                    logs.Add(new LogInfo(LogState.Error, $"File filter pattern [{filter}] is invalid", cmd));
                                }
                            }
                        }
                        else
                        {                 // Select Folder
                            if (subInfo.Filter != null)
                            {
                                logs.Add(new LogInfo(LogState.Warning, $"File filters cannot be used for folder selection", cmd));
                            }
                        }
                    }
                    break;
                    }
                }
                break;

                    #endregion
                    #region Check InterfaceSections
                case CodeType.AddInterface:
                {
                    CodeInfo_AddInterface info = cmd.Info.Cast <CodeInfo_AddInterface>();

                    // CodeValidator does not have Variable information, so just check with predefined literal
                    if (info.ScriptFile.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                        !CodeParser.StringContainsVariable(info.Section))
                    {
                        targetInterfaceSection = info.Section;
                    }
                }
                break;

                case CodeType.ReadInterface:
                {
                    CodeInfo_ReadInterface info = cmd.Info.Cast <CodeInfo_ReadInterface>();

                    // CodeValidator does not have Variable information, so just check with predefined literal
                    if (info.ScriptFile.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                        !CodeParser.StringContainsVariable(info.Section))
                    {
                        targetInterfaceSection = info.Section;
                    }
                }
                break;

                case CodeType.WriteInterface:
                {
                    CodeInfo_WriteInterface info = cmd.Info.Cast <CodeInfo_WriteInterface>();

                    // CodeValidator does not have Variable information, so just check with predefined literal
                    if (info.ScriptFile.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                        !CodeParser.StringContainsVariable(info.Section))
                    {
                        targetInterfaceSection = info.Section;
                    }
                }
                break;

                case CodeType.IniWrite:
                {
                    // To detect multi-interface without `InterfaceList=`,
                    // Inspect pattern `IniWrite,%ScriptFile%,Main,Interface,<NewInterfaceSection>`
                    CodeInfo_IniWrite info = cmd.Info.Cast <CodeInfo_IniWrite>();

                    // CodeValidator does not have Variable information, so just check with predefined literal
                    if (info.FileName.Equals(Script.Const.ScriptFile, StringComparison.OrdinalIgnoreCase) &&
                        info.Section.Equals(ScriptSection.Names.Main, StringComparison.OrdinalIgnoreCase) &&
                        info.Key.Equals(ScriptSection.Names.Interface, StringComparison.OrdinalIgnoreCase) &&
                        !CodeParser.StringContainsVariable(info.Value))
                    {
                        targetInterfaceSection = info.Value;
                    }
                }
                break;
                    #endregion
                }

                if (targetCodeSection != null)
                {
                    if (_sc.Sections.ContainsKey(targetCodeSection))
                    {
                        logs.AddRange(CheckCodeSection(_sc.Sections[targetCodeSection], cmd.RawCode, cmd.LineIdx));
                    }
                    else
                    {
                        logs.Add(new LogInfo(LogState.Error, $"Section [{targetCodeSection}] does not exist", cmd));
                    }
                }

                if (targetInterfaceSection != null)
                {
                    if (_sc.Sections.ContainsKey(targetInterfaceSection))
                    {
                        logs.AddRange(CheckInterfaceSection(_sc.Sections[targetInterfaceSection], cmd.RawCode, cmd.LineIdx));
                    }
                    else
                    {
                        logs.Add(new LogInfo(LogState.Error, $"Section [{targetInterfaceSection}] does not exist", cmd));
                    }
                }
            }
        }
Ejemplo n.º 22
0
 IEnumerator ShowButtonHints(UserInputType[] hintTypes)
 {
     yield return new WaitForEndOfFrame();
     foreach(UserInputType t in hintTypes)
     {
         if(t == this.Tap)
         {
             showHint = true;
             stopHintTime = Time.time + 3;
         }
     }
 }
Ejemplo n.º 23
0
 public UserInputData(UserInputType _Type, Vector2? direction, float _StartTime, float _EndTime)
 {
     Type = _Type;
     gestureDirection = direction;
     StartTime = _StartTime;
     EndTime = _EndTime;
 }
Ejemplo n.º 24
0
 public UserInputEventArgs(string message, UserInputType userInputType)
 {
     this.Message       = message;
     this.UserInputType = userInputType;
 }
Ejemplo n.º 25
0
        protected override void Seed(HR1Context context)
        {
            UserInputType dtText = new UserInputType()
            {
                Description = "Text", Code = "TEXT"
            };
            UserInputType dtWholeNumber = new UserInputType()
            {
                Description = "WholeNumber", Code = "INT"
            };
            UserInputType dtDecimal = new UserInputType()
            {
                Description = "Currency", Code = "CURRENCY"
            };
            UserInputType dtPercentage = new UserInputType()
            {
                Description = "Percentage", Code = "PCT"
            };
            UserInputType dtDate = new UserInputType()
            {
                Description = "Date", Code = "DATE"
            };
            UserInputType dtList = new UserInputType()
            {
                Description = "List", Code = "LIST"
            };
            UserInputType dtYear = new UserInputType()
            {
                Description = "Year", Code = "YEAR"
            };
            UserInputType dtBoolean = new UserInputType()
            {
                Description = "Boolean", Code = "BOOL"
            };

            context.UserInputTypes.Add(dtText);
            context.UserInputTypes.Add(dtWholeNumber);
            context.UserInputTypes.Add(dtDecimal);
            context.UserInputTypes.Add(dtPercentage);
            context.UserInputTypes.Add(dtDate);
            context.UserInputTypes.Add(dtList);
            context.UserInputTypes.Add(dtYear);
            context.UserInputTypes.Add(dtBoolean);


            var jtGeneral = new JournalType()
            {
                Name = "General", Code = "GEN"
            };
            var jtPaystub = new JournalType()
            {
                Name = "Pay Stub", Code = "PAYSTUB"
            };

            context.JournalTypes.Add(jtGeneral);
            context.JournalTypes.Add(jtPaystub);
            context.JournalTypes.Add(new JournalType()
            {
                Name = "Payment", Code = "PAY"
            });


            jtGeneral.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Defined Amount", IsCode = "AMT", OfCode = "null"
            });
            jtGeneral.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Percentage of ledger account", IsCode = "PERC", OfCode = "LEDGER"
            });


            jtPaystub.JournalTxnTypes.Add(new JournalTxnType()
            {
                Name = "Defined Amount", IsCode = "AMT", OfCode = "null"
            });


            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "Defined Amount", IsDailyCalc = false, IsDefinedAmount = true, IsPercentage = false, OfContextParameter = false, OfCoveragePremium = false, OfLedgerAccount = false });
            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "% of Coverage Premium", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = false, OfCoveragePremium = true, OfLedgerAccount = false });
            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "% of Ledger Account", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = false, OfCoveragePremium = false, OfLedgerAccount = true });
            //context.JournalTxnClasses.Add(new JournalTxnClass() { Description = "% of Contextual Parameter", IsDailyCalc = false, IsDefinedAmount = false, IsPercentage = true, OfContextParameter = true, OfCoveragePremium = false, OfLedgerAccount = false });



            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Current Asset", IsAsset = true, IsCurrent = true, CreditPositive = false });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Non-Current Asset", IsAsset = true, IsCurrent = false, CreditPositive = false });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Current Liability", IsLiability = true, IsCurrent = true, CreditPositive = true });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Non-Current Liability", IsLiability = true, IsCurrent = false, CreditPositive = true });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Expense", IsExpense = true, IsCurrent = true, CreditPositive = false });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Income", IsIncome = true, IsCurrent = true, CreditPositive = true });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Debtors", IsAsset = true, IsDebtor = true, IsCurrent = true, CreditPositive = false });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Creditors", IsLiability = true, IsCredior = true, IsCurrent = true, CreditPositive = true });
            //context.LedgerAccountTypes.Add(new LedgerAccountType() { Name = "Equity", IsEquity = true, CreditPositive = true });


            base.Seed(context);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// The "Constructor" for a BaseLogData with LogDataType of UserInput
 /// </summary>
 /// <remarks>
 /// <para>Here, you are expected to set the LogType, Message, ShortLogMessage and LongLogMessage. </para>
 /// <para>LongLogMessage is what is outputted to the .txt log</para>
 /// </remarks>
 public abstract void CreateUserInputLogData(UserInputType type, string message);