Example #1
0
 internal NextRequested(
     [CanBeNull] IPlayableId track,
     NextType type)
 {
     Track    = track;
     NextType = type;
 }
Example #2
0
    public static Zone GetNext(NextType nextType, Zone from, int index = 0)
    {
        GameData    game = GameData.Instance;
        List <Zone> l    = null;

        switch (nextType)
        {
        case NextType.StationZone: l = GetAllNextStation(from); break;

        case NextType.NeutralZone: l = GetAllNextNeutral(from); break;

        case NextType.LessMinionBlockade: l = GetAllBlockadeZone(); break;

        case NextType.Undiscovered: l = GetAllUndiscoveredZone(from); break;

        case NextType.EnemyZone: l = GetAllEnemyZone(from); break;

        case NextType.EnemyStationZone: l = GetAllEnemyZone(game.enemyFlagLocalisation); break;
        }
        index = MyMath.Clamp(index, 0, l.Count);
        if (l == null || l.Count <= 0)
        {
            return(null);
        }
        return(l[index]);
    }
Example #3
0
 public override FileObject GetFile(string path)
 {
     if (Path.GetExtension(path).ToUpper() == ".ZIP" || NextType == null)
     {
         return(new ZipFileObj(path));
     }
     else
     {
         return(NextType.GetFile(path));
     }
 }
        private void ShowActivityIndicatorForNext(NextType nextType)
        {
            btnNext.Hidden = false;

            if (nextType == NextType.Next)
            {
                btnSkip.Hidden = false;
                btnNext.SetTitle(LangUtil.Get("Initial.Next") + "", UIControlState.Normal);
            }
            else if (nextType == NextType.Finished)
            {
                btnSkip.Hidden = true;
                btnNext.SetTitle(LangUtil.Get("Initial.Finished"), UIControlState.Normal);
            }
        }
Example #5
0
        public NextType GetNext(string code, int f)
        {
            f++;
            NextType nt = NextType.Unknown;

            if (f >= code.Length)

            {
                return(NextType.Eol);
            }
            for (int c = f; f < code.Length; c++)
            {
                if (c >= code.Length)
                {
                    break;
                }

                char   cc = code[c];
                string cs = cc.ToString();
                if (cs == " ")
                {
                    return(NextType.Space);
                }
                if (cs == ",")
                {
                    return(NextType.Sep);
                }
                if (cs[0] >= "a"[0] && cs[0] <= "z"[0])
                {
                    return(NextType.Alpha);
                }
                if (cs[0] >= "A"[0] && cs[0] <= "Z"[0])
                {
                    return(NextType.Alpha);
                }
                if (cs[0] >= "0"[0] && cs[0] <= "9"[0])
                {
                    return(NextType.Num);
                }
                if (cs == "=")
                {
                    return(NextType.Equal);
                }
            }
            return(nt);
        }
Example #6
0
 public NextRoutine(Program i_prog, ArmadaSymbolTable i_symbols, NextType i_nextType, MethodInfo i_methodInfo,
                    ArmadaStatement i_armadaStatement, Statement i_stmt, ArmadaPC i_startPC, ArmadaPC i_endPC,
                    List <NextFormal> i_formals, string i_nameSuffix, bool i_undefinedBehavior, bool i_stopping)
 {
     prog              = i_prog;
     symbols           = i_symbols;
     nextType          = i_nextType;
     methodInfo        = i_methodInfo;
     armadaStatement   = i_armadaStatement;
     stmt              = i_stmt;
     startPC           = i_startPC;
     endPC             = i_endPC;
     formals           = new List <NextFormal>(i_formals);
     nameSuffix        = i_nameSuffix;
     undefinedBehavior = i_undefinedBehavior;
     stopping          = i_stopping;
 }
Example #7
0
 /// <summary>
 /// Move to and return whether there is another item.
 /// </summary>
 public bool Next()
 {
     if (_queue.Dequeue())
     {
         if (_queue.Current)
         {
             CurrentType = NextType.A;
             ItemsA.Dequeue();
         }
         else
         {
             CurrentType = NextType.B;
             ItemsB.Dequeue();
         }
         return(true);
     }
     return(false);
 }
Example #8
0
        public NextRoutineConstructor(Program i_prog, ArmadaSymbolTable i_symbols, NextType i_nextType, MethodInfo i_methodInfo,
                                      ArmadaStatement i_armadaStatement, Statement i_stmt, ArmadaPC i_startPC, ArmadaPC i_endPC)
        {
            prog     = i_prog;
            symbols  = i_symbols;
            nextType = i_nextType;
            validDefinedStepBuilder   = new PredicateBuilder(i_prog, true);
            validUndefinedStepBuilder = new PredicateBuilder(i_prog, false);
            getNextStateBuilder       = new ExpressionBuilder(i_prog);
            methodInfo      = i_methodInfo;
            method          = methodInfo == null ? null : methodInfo.method;
            armadaStatement = i_armadaStatement;
            stmt            = i_stmt;
            startPC         = i_startPC;
            endPC           = i_endPC;
            formals         = new List <NextFormal>();
            valid           = true;
            hasUndefinedBehaviorAvoidanceConstraint = false;
            definedBehaviorNextRoutine   = null;
            undefinedBehaviorNextRoutine = null;

            s     = ReserveVariableName("s");
            entry = ReserveVariableName("entry");
            tid   = ReserveVariableName("tid");
            t     = ReserveVariableName("t");
            locv  = ReserveVariableName("locv");

            if (startPC != null)
            {
                AddConjunct($"{t}.pc.{startPC}?");
                AddConjunct($"{t}.top.Armada_StackFrame_{startPC.methodName}?");

                if (methodInfo != null)
                {
                    var constraints = methodInfo.GetEnablingConstraintCollector(startPC);
                    if (constraints != null && !constraints.Empty)
                    {
                        AddConjunct($"Armada_EnablingConditions_{startPC}(s, tid)");
                    }
                }

                AddConjunct("Armada_UniversalStepConstraint(s, tid)");
            }
        }
Example #9
0
    public static Zone GetNext(NextType nextType, Zone from)
    {
        List <Zone> l = null;

        switch (nextType)
        {
        case NextType.StationZone: l = GetAllNextStation(from); break;

        case NextType.NeutralZone: l = GetAllNextNeutral(from); break;

        case NextType.LessMinionBlockade: l = GetAllBlocusZone(); break;

        case NextType.Undiscovered: l = GetAllUndiscoveredZone(from); break;
        }
        if (l == null || l.Count <= 0)
        {
            return(null);
        }
        return(l[0]);
    }
Example #10
0
        //public HtmlItem Previous(NextType recursiveType)
        //{
        //    //if no parent, there's no previous
        //    if (Parent == null)
        //        return null;

        //    HtmlItem previousSibling = PreviousSibling();


        //}

        public HtmlItem Next(NextType recursiveType)
        {
            if ((recursiveType & NextType.Down) == NextType.Down)
            {
                //pick first child if it exists
                if (Children.Count > 0)
                {
                    return(Children[0]);
                }
            }

            //otherwise look at the parent for the next
            if (Parent == null)
            {
                return(null);
            }

            int index = Parent.Children.IndexOf(this);

            //if there's a next item on the same level
            if ((recursiveType & NextType.SameLevel) == NextType.SameLevel)
            {
                if (index + 1 < Parent.Children.Count)
                {
                    return(Parent.Children[index + 1]);
                }
            }


            //otherwise if we can look recursive up higher
            if ((recursiveType & NextType.Up) == NextType.Up)
            {
                return(Parent.next());
            }

            return(null);
        }
Example #11
0
    public static bool CheckCondition(NextType nextDestination, Zone zone, int numMaxSquadComing = int.MaxValue)
    {
        if (zone == null)
        {
            return(false);
        }
        if (zone.data.incomingSquad > numMaxSquadComing)
        {
            return(false);
        }
        switch (nextDestination)
        {
        case NextType.Undiscovered: return(zone.data.viewed == false);

        case NextType.StationZone: return(zone.data.platinum >= 1 && !zone.IsOwnedByMe());

        case NextType.NeutralZone: return(zone.IsNeutralZone());

        case NextType.LessMinionBlockade: return(zone.data.isBlockadePoint);

        case NextType.EnemyZone: return(zone.IsOwnedByEnemy());
        }
        return(false);
    }
Example #12
0
        public NextRoutine(Program i_prog, ArmadaSymbolTable i_symbols, NextType i_nextType, MethodInfo methodInfo,
                           ArmadaStatement i_armadaStatement, Statement i_stmt, ArmadaPC i_pc, ArmadaPC i_endPC)
        {
            prog                  = i_prog;
            symbols               = i_symbols;
            nextType              = i_nextType;
            validStepBuilder      = new PredicateBuilder(i_prog);
            crashAvoidanceBuilder = new PredicateBuilder(i_prog);
            getNextStateBuilder   = new ExpressionBuilder(i_prog);
            method                = methodInfo != null ? methodInfo.method : null;
            armadaStatement       = i_armadaStatement;
            stmt                  = i_stmt;
            pc      = i_pc;
            endPC   = i_endPC;
            formals = new List <NextFormal>();
            valid   = true;

            s    = ReserveVariableName("s", "Armada_TotalState");
            tid  = ReserveVariableName("tid", "Armada_ThreadHandle");
            locv = null;

            // s.stop_reason.Armada_NotStopped?
            var stop_reason = AH.MakeExprDotName(s, "stop_reason", "Armada_StopReason");
            var not_stopped = AH.MakeExprDotName(stop_reason, "Armada_NotStopped?", new BoolType());

            AddConjunct(not_stopped);

            // tid in s.threads
            var threads        = AH.MakeExprDotName(s, "threads", AH.MakeThreadsType());
            var tid_in_threads = AH.MakeInExpr(tid, threads);

            AddConjunct(tid_in_threads);

            // var t := s.threads[tid];
            t = AddVariableDeclaration("t", AH.MakeSeqSelectExpr(threads, tid, "Armada_Thread"));

            // var locv := Armada_GetThreadLocalView(s, tid);
            locv = AH.MakeApply2("Armada_GetThreadLocalView", s, tid, "Armada_SharedMemory");
            locv = AddVariableDeclaration("locv", locv);

            if (pc != null)
            {
                var current_pc = AH.MakeExprDotName(t, "pc", "Armada_PC");
                var pc_correct = AH.MakeEqExpr(current_pc, AH.MakeNameSegment(pc.ToString(), "Armada_PC"));
                AddConjunct(pc_correct);

                // t.top.Armada_StackFrame_{methodName}?
                var top = AH.MakeExprDotName(t, "top", "Armada_StackFrame");
                var top_frame_correct = AH.MakeExprDotName(top, $"Armada_StackFrame_{pc.methodName}?", new BoolType());
                AddConjunct(top_frame_correct);

                if (methodInfo != null)
                {
                    var constraints = methodInfo.GetEnablingConstraintCollector(pc);
                    if (constraints != null && !constraints.Empty)
                    {
                        var enabling_condition = AH.MakeApply2($"Armada_EnablingConditions_{pc}", s, tid, new BoolType());
                        AddConjunct(enabling_condition);
                    }
                }
            }
        }