/// <summary>
        /// Adds an expression for an Undup-action
        /// Signature: func(PipelineContext ctx, List&lt;JObject&gt; records, int offset, int len)
        /// </summary>
        public void AddUndupExpression(String name, String code)
        {
            ++count;
            code = code.TrimWhiteSpace();
            Needed neededVars = checkNeeded(code);

            wtr.Write("      public void ");
            wtr.Write(name);
            wtr.Write(" (PipelineContext ctx, List<JObject> records, int offset, int len)\r\n      {\r\n");
            if ((neededVars & (Needed.PostProcessor)) != 0)
            {
                wtr.Write("         var processor = ctx.PostProcessor;\r\n");
            }

            wtr.Write("         ");
            wtr.Write(code);
            writeMethodExit(!code.EndsWith(";"));

            //if ((neededVars & (Needed.PostProcessor | Needed.Endpoint | Needed.Record)) != 0)
            //   wtr.Write("         var processor = ctx.PostProcessor;\r\n");
            //if ((neededVars & (Needed.Endpoint | Needed.Record)) != 0)
            //   wtr.Write("         var endpoint = action.Endpoint;\r\n");
            //if ((neededVars & (Needed.Record)) != 0)
            //   wtr.Write("         var record = (JObject)endpoint.GetFieldAsToken (null);\r\n");
        }
예제 #2
0
 void Start()
 {
     // getcomponents
     needed = GetComponent <Needed>();
     stages = GetComponent <Stages>();
     data   = stages.data;
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     CurrentStageLevelInput = SceneManager.GetActiveScene().buildIndex; // get the current scene index
     // getcomponent
     need         = GetComponent <Needed>();
     toolbox      = GetComponent <Toolbox>();
     scourceAudio = GetComponent <AudioSource>();
     // set next question to false
     nextQuestion.interactable = false;
     // find background audio // this is used to get the data and insertdata scripts
     id         = GameObject.FindWithTag("BackAudio");
     data       = id.GetComponent <Data>();
     insertData = id.GetComponent <InsertData>();
     // set current level, set question answers and send data
     CurrentStageActive(CurrentStageLevelInput);
 }
        private void writeMethodEntry(String name, String code)
        {
            Needed neededVars = checkNeeded(code);

            wtr.Write("      public Object ");
            wtr.Write(name);
            wtr.Write(" (PipelineContext ctx, Object value)\r\n      {\r\n");
            if ((neededVars & (Needed.Action | Needed.Endpoint | Needed.Record)) != 0)
            {
                wtr.Write("         var action = ctx.Action;\r\n");
            }
            if ((neededVars & (Needed.Endpoint | Needed.Record)) != 0)
            {
                wtr.Write("         var endpoint = action.Endpoint;\r\n");
            }
            if ((neededVars & (Needed.Record)) != 0)
            {
                wtr.Write("         var record = (JObject)endpoint.GetFieldAsToken (null);\r\n");
            }
        }
예제 #5
0
        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            int v = (int)Value;

            switch (BinderType)
            {
            case BinderType.None: break;

            case BinderType.PowerScroll:
            {
                string skillName = SkillInfo.Table[(int)Skill].Name;

                list.Add(1113149, string.Format("{0}\t{1}\t{2}\t{3}", v.ToString(), skillName, ((int)Has).ToString(), Needed.ToString()));         // ~1_bonus~ ~2_type~: ~3_given~/~4_needed~
                break;
            }

            case BinderType.StatScroll:
            {
                list.Add(1113149, string.Format("+{0}\t#{1}\t{2}\t{3}", v - 225, 1049477, ((int)Has).ToString(), Needed.ToString()));         // ~1_bonus~ ~2_type~: ~3_given~/~4_needed~
                break;
            }

            case BinderType.SOT:
            {
                string value     = string.Format("{0:0.##}", Has);
                string skillName = SkillInfo.Table[(int)Skill].Name;
                int    number;

                if (Needed == 2)
                {
                    number = 1113148;         // ~1_type~ transcendence: ~2_given~/2.0
                }
                else
                {
                    number = 1113620;         // ~1_type~ transcendence: ~2_given~/5.0
                }
                list.Add(number, string.Format("{0}\t{1}", skillName, value));
                break;
            }
            }
        }
예제 #6
0
        private static Needed GetNeeded(int band, int?adif, string gridSquare, string mode)
        {
            if (!adif.HasValue)
            {
                return(Needed.No);
            }

            int dxcc = adif.Value;

            int qsosWithThatCountryOnAnyBand = int.Parse(HttpGet($"country_worked/{dxcc}/all"));

            var result = new Needed();

            if (qsosWithThatCountryOnAnyBand == 0)
            {
                result.NewCountryOnAnyBand = true;
            }
            else
            {
                int qsosWithThatCountryOnCurrentBand = int.Parse(HttpGet($"country_worked/{dxcc}/{band}m"));

                if (qsosWithThatCountryOnCurrentBand == 0)
                {
                    result.NewCountryOnBand = true;
                }
                else
                {
                    int qsosWithThatCountryOnThatBandInThisMode = int.Parse(HttpGet($"country_worked/{dxcc}/{band}m/{mode}"));
                    if (qsosWithThatCountryOnThatBandInThisMode == 0)
                    {
                        result.NewCountryOnBandOnMode = true;
                    }
                }
            }

            if (!String.IsNullOrWhiteSpace(gridSquare) && gridSquare.Length >= 4)
            {
                if (gridSquare.Length > 4)
                {
                    gridSquare = gridSquare.Substring(0, 4);
                }

                int qsosWithThatGridOnAnyBand = int.Parse(HttpGet($"gridsquare_worked/{gridSquare}/all"));
                if (qsosWithThatGridOnAnyBand == 0)
                {
                    result.NewGridOnAnyBand = true;
                }
                else
                {
                    int qsosWithThatGridOnThatBand = int.Parse(HttpGet($"gridsquare_worked/{gridSquare}/{band}m"));
                    if (qsosWithThatGridOnThatBand == 0)
                    {
                        result.NewGridOnBand = true;
                    }
                    else
                    {
                        int qsosWithThatGridOnThatBandInThisMode = int.Parse(HttpGet($"gridsquare_worked/{gridSquare}/{band}m/{mode}"));
                        if (qsosWithThatGridOnThatBandInThisMode == 0)
                        {
                            result.NewGridOnBandOnMode = true;
                        }
                    }
                }
            }

            return(result);
        }