Пример #1
0
		private void CollectIndexedNodes(IEnumerator qcons)
		{
			while (qcons.MoveNext())
			{
				QCon qcon = (QCon)qcons.Current;
				if (IsCached(qcon))
				{
					continue;
				}
				if (IsLeaf(qcon))
				{
					if (qcon.CanLoadByIndex() && qcon.CanBeIndexLeaf())
					{
						QConObject conObject = (QConObject)qcon;
						if (conObject.HasJoins())
						{
							CollectJoinedNode(conObject);
						}
						else
						{
							CollectStandaloneNode(conObject);
						}
					}
				}
				else
				{
					if (!qcon.HasJoins())
					{
						CollectIndexedNodes(qcon.IterateChildren());
					}
				}
			}
		}
Пример #2
0
    public override void Attack()
    {
        flashKickRoutine = FlashKickRoutine();
        StartCoroutine(flashKickRoutine);

        owner.DisableHurtBox();
    }
Пример #3
0
        private static StringBuilder ParseQueryStringParameters(IEnumerator<char> tokenizer, StringBuilder routePattern, IList<string> queryParameters)
        {
            var parameterName = new StringBuilder();

            bool endOfStream = false;

            while (!endOfStream && tokenizer.Current != '&')
            {
                parameterName.Append(tokenizer.Current);
                endOfStream = !tokenizer.MoveNext();
            }

            string param = parameterName.ToString();
            routePattern.Append(string.Format(@"(?<{0}{2}>[^=\?&]+)=(?<{1}{2}>[^&]+)", QueryParameterGroupName, QueryParameterValueGroupName, queryParameters.Count));
            queryParameters.Add(param);

            if (endOfStream)
                return routePattern;
            else
            {
                routePattern.Append(Regex.Escape(tokenizer.Current.ToString(CultureInfo.InvariantCulture)));
                tokenizer.MoveNext();
                return ParseQueryStringParameters(tokenizer, routePattern, queryParameters);
            }
        }
Пример #4
0
            internal IterIsolateEnumerator(IEnumerator enumerator)
            {
                // if this is the enumerator from another iterator, we
                    // don't have to enumerate it; we'll just steal the arraylist
                    // to use for ourselves.
                IterIsolateEnumerator chainedEnumerator =
                    enumerator as IterIsolateEnumerator;

                if (chainedEnumerator != null)
                {
                    items = chainedEnumerator.items;
                }
                else
                {
                    items = new ArrayList();
                    while (enumerator.MoveNext() != false)
                    {
                        items.Add(enumerator.Current);
                    }
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
                currentItem = -1;
            }
Пример #5
0
        private static StringBuilder ParseRoute(IEnumerator<char> tokenizer, StringBuilder routePattern, IDictionary<string, string> routeParametersVsNamedGroup, IList<string> queryParameters)
        {
            char nextCharacterInRoute = tokenizer.Current;

            if (nextCharacterInRoute == '{')
            {
                tokenizer.MoveNext();
                return ParseRouteParameter(tokenizer, routePattern, routeParametersVsNamedGroup, queryParameters);
            }
            else if (nextCharacterInRoute == '?')
            {
                routePattern.Append(Regex.Escape(nextCharacterInRoute.ToString(CultureInfo.InvariantCulture)));
                tokenizer.MoveNext();
                return ParseQueryStringParameters(tokenizer, routePattern, queryParameters);
            }
            else
            {
                routePattern.Append(Regex.Escape(nextCharacterInRoute.ToString(CultureInfo.InvariantCulture)));
                if (tokenizer.MoveNext())
                    return ParseRoute(tokenizer, routePattern, routeParametersVsNamedGroup, queryParameters);
                else
                    return routePattern;

            }
        }
Пример #6
0
 //    
 //    void OnGUI()
 //    {
 //        Vector3 screen_pos = Camera.main.WorldToScreenPoint (transform.position);
 //        GUI.Label(new Rect(screen_pos.x - 100, Screen.height - screen_pos.y+30, 200, 15), current_hp + "/" + max_hp + " HP", enginePlayerS.hover_text);
 //        GUI.Label(new Rect(screen_pos.x - 100, Screen.height - screen_pos.y + 45, 200, 15), current_ap + "/" + max_ap + " AP", enginePlayerS.hover_text);
 //    }
 public static void moveToHexViaPath(Path _travel_path)
 {
     travel_path = _travel_path.getTraverseOrderList();
     travel_path_en = travel_path.GetEnumerator();
     travel_path_en.MoveNext();
     moving_on_path = true;
 }
Пример #7
0
    /*private bool firstTime=false;

    void OnTriggerStay2D(Collider2D theOther)
    { 
        player = theOther.transform.gameObject;
       
        if (pressingDown()&&!firstTime)
        {
            StartCoroutine(preparingRitual());
        }
    }
    void PlayDestroySound()
    {
        gameObject.GetComponent<AudioSource>().Play();

    }

    private bool pressingDown()
    {
        return Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow);
    }

    private IEnumerator preparingRitual()
    {
        firstTime = true;
        float startTime, actualTime, duration, time;
        bool ritualStarted = false;
        time = 1f;
        startTime = Time.time;
        while (pressingDown())
        {
            actualTime = Time.time;
            duration = actualTime - startTime;
            if (duration >= 2f && !ritualStarted)
            {
                startRitual();
                ritualStarted = true;
            }
            yield return new WaitForSeconds(time);
        }
        yield return null;
    }

    private void startRitual()
    {
        this.transform.gameObject.SetActive(false);
        player.GetComponent<StressUpdater>().decreaseAnxiety(0.5f);
        firstTime = false;
    }*/

    void OnTriggerEnter2D(Collider2D theOther)
    {
        player = theOther.transform.gameObject;
        player.gameObject.GetComponent<PlatformerCharacter2D>().triggerRitual();
        removeAnxietyCoroutine = removeAnxiety();
        StartCoroutine(removeAnxietyCoroutine);
    }
Пример #8
0
 internal MonetDbDataReader(IEnumerable<MonetDBQueryResponseInfo> ri, MonetDbConnection con)
 {
     _con = con;
     this.eri = ri;
     this.enum_ri = ri.GetEnumerator();
     this.NextResult();
 }
Пример #9
0
 void Awake()
 {
     watcherCoroutine = extendedFingerWatcher();
       if(HandModel == null){
     HandModel = gameObject.GetComponentInParent<IHandModel>();
       }
 }
 /// <summary>
 /// Start a co-routine on a background thread.
 /// </summary>
 /// <param name="task">Gets a task object with more control on the background thread.</param>
 /// <returns></returns>
 public static Coroutine StartCoroutineAsync(
     this MonoBehaviour behaviour, IEnumerator routine, 
     out Task task)
 {
     task = new Task(routine);
     return behaviour.StartCoroutine(task);
 }
Пример #11
0
        IEnumerator EnumeratorDecorator(IEnumerator enumerator, TaskRoutine task)
        {
            while (enumerator.MoveNext() == true)
                yield return enumerator.Current;

            _pool.Enqueue(task);
        }
Пример #12
0
		public virtual void AddAll(IEnumerator iterator)
		{
			while (iterator.MoveNext())
			{
				Add(iterator.Current);
			}
		}
 /// <summary>
 /// Construct an enumerator over the out-edges
 /// </summary>
 /// <param name="vertexOutEdges">Out edge dictionary to iterate</param>
 /// <exception cref="ArgumentNullException">vertexOutEdges is null</exception>
 public VertexEdgesEnumerator(VertexEdgesDictionary vertexOutEdges)
 {
     if (vertexOutEdges == null)
         throw new ArgumentNullException("vertexOutEdges");
     VertexOutEdgeEnumerator = vertexOutEdges.GetEnumerator();
     OutEdgeEnumerator = null;
 }
    public virtual void Awake()
    {
        base.Awake();

        Assert.raiseExceptions = true;

        // Find all UI elements in the scene
        D_TimeLeftText = GameObject.Find("D_TimeLeftText").GetComponent<Text>();
        D_DefuseBombButton = GameObject.Find("D_DefuseBombButton").GetComponent<Button>();
        D_HintLeftBehind = GameObject.Find("D_HintLeftBehind").GetComponent<Text>();
        D_HintLeftBehind2 = GameObject.Find("D_HintLeftBehind2").GetComponent<Text>();
        D_HintLeftBehind3 = GameObject.Find("D_HintLeftBehind3").GetComponent<Text>();
        D_Waiting = GameObject.Find("D_Waiting").GetComponent<Text>();
        D_Tutorial = GameObject.Find("D_Tutorial").GetComponent<Button>();
        D_TutorialHints = GameObject.Find("D_TutorialHints").GetComponent<Button>();
        D_GiveUp = GameObject.Find ("D_GiveUp").GetComponent<Button>();
		D_Penalty = GameObject.Find ("D_Penalty").GetComponent<Text>();
		D_AllDefusedText = GameObject.Find ("D_AllDefusedText").GetComponent<Text>();

        //find bomb tag
        //bombs = GameObject.FindGameObjectsWithTag("Bomb");

        Assert.IsNotNull(D_TimeLeftText, "D_TimeLeftText not found");
        Assert.IsNotNull(D_DefuseBombButton, "D_DefuseBombButton not found");
        Assert.IsNotNull(D_HintLeftBehind, "D_HintLeftBehind not found");
        Assert.IsNotNull(D_HintLeftBehind2, "D_HintLeftBehind2 not found");
        Assert.IsNotNull(D_HintLeftBehind3, "D_HintLeftBehind3 not found");
        Assert.IsNotNull(D_Waiting, "D_Waiting not found");

		//Set hint penalty fade coroutine
		fadePenaltyCoroutine = FadeAlphaOut();
    }
Пример #15
0
 public virtual void Next()
 {
     if (enumerator == null)
     {
         enumerator = Steps.GetEnumerator();
         enumerator.MoveNext();
         step = enumerator.Current;
         this.OnNext(Step);
     }
     else
     {
         if (Step != Steps.Last())
         {
             enumerator.MoveNext();
             step = enumerator.Current;
             this.OnNext(Step);
         }
         else
         {
             if (OnFinished != null)
             {
                 OnFinished();
             }
         }
     }
 }
Пример #16
0
 void Start()
 {
     initialPosition = transform.position;
     _jumpRoutine = JumpAnim();
     StartCoroutine(_jumpRoutine);
     _treasurePrefab = Resources.Load("Prefabs/LittleTreasure") as GameObject;
 }
Пример #17
0
		public SearchAgent(Problem p, Search search) 
		{
			actionList = search.search(p);
			actionIterator = actionList.GetEnumerator();
			searchMetrics = search.getMetrics();

		}
Пример #18
0
        internal Match(ParseStep parseStep, IEnumerator<ParseStep> stepEnumerator, IEnumerable<IList<ParenCapture>> captureSet)
            : base(0, parseStep.InitialStateIndex, parseStep.MatchedText.Length, parseStep.MatchedText, true)
        {
            _stepEnumerator = stepEnumerator;
            Groups = new GroupCollection();
            Groups.Append(this);
            Captures.Prepend(this);

            foreach (var parenCaptures in captureSet)
            {
                var parenCapture = parenCaptures[0];

                var group = new Group(parenCapture.Number,
                                      parenCapture.Index,
                                      parenCapture.Value.Length,
                                      parenCapture.Value,
                                      parenCapture.Success);
                Groups.Append(group);

                if (parenCapture.Success)
                {
                    group.Captures.Prepend(group);
                }

                if (parenCaptures.Skip(1).All(c => c.Success))
                {
                    for (int i = 1; i < parenCaptures.Count; i++)
                    {
                        group.Captures.Prepend(new Capture(parenCaptures[i].Index,
                                                           parenCaptures[i].Value.Length,
                                                           parenCaptures[i].Value));
                    }
                }
            }
        }
Пример #19
0
    void Awake()
    {
        DialogScreenPrefab = (GameObject)Resources.Load("DialogScreen");

        isDialogOn = false;
        e = test ();
    }
        private static byte[] DecodeByteArray(IEnumerator<byte> enumerator)
        {
            List<byte> lengthBytes = new List<byte>();

            // scan until we get to divider
            do
            {
                if( enumerator.Current == ByteArrayDivider )
                    break;

                lengthBytes.Add(enumerator.Current);
            }
            while (enumerator.MoveNext());

            string lengthString = System.Text.Encoding.UTF8.GetString(lengthBytes.ToArray());

            int length;
            if (!Int32.TryParse(lengthString, out length))
                throw new Exception("unable to parse length of byte array");

            // now read in the actual byte array
            byte[] bytes = new byte[length];

            for (int i = 0; i < length; i++)
            {
                enumerator.MoveNext();
                bytes[i] = enumerator.Current;
            }

            return bytes;
        }
Пример #21
0
		internal SAMGroupsSet(UnsafeNativeMethods.IADsMembers iADsMembers, SAMStoreCtx storeCtx, DirectoryEntry ctxBase)
		{
			this.atBeginning = true;
			this.groupsEnumerator = ((IEnumerable)iADsMembers).GetEnumerator();
			this.storeCtx = storeCtx;
			this.ctxBase = ctxBase;
		}
        public override IEnumerable GetTestCases()
        {
            ArrayList testCases = new ArrayList();
#endif
            IEnumerator[] enumerators = new IEnumerator[Sources.Length];
            int index = -1;

            for (; ; )
            {
                while (++index < Sources.Length)
                {
                    enumerators[index] = Sources[index].GetEnumerator();
                    if (!enumerators[index].MoveNext())
						return testCases;
                }

                object[] testdata = new object[Sources.Length];

                for (int i = 0; i < Sources.Length; i++)
                    testdata[i] = enumerators[i].Current;

                ParameterSet parms = new ParameterSet();
                parms.Arguments = testdata;
				testCases.Add(parms);

                index = Sources.Length;

                while (--index >= 0 && !enumerators[index].MoveNext()) ;

                if (index < 0) break;
            }

			return testCases;
        }
 public PartiallyClosedCircuitBreakerState(CircuitBreaker breaker, Exception exception,
     IEnumerator<int> timeoutEnumerator)
     : base(breaker)
 {
     _exception = exception;
     _timeoutEnumerator = timeoutEnumerator;
 }
Пример #24
0
        public CsvReader(TextReader reader, CsvReaderOptions options)
        {
            _lineReader = new LineReader(options, reader);

            _cursor = _lineReader.GetLines().GetEnumerator();

            // Read the first line, as we expect it to have headers
            _cursor.MoveNext();

            // The file format here is that the first row includes the
            // columnHeaders in the format "<name>:<type>"
            var columnHeaders = _cursor.Current;

            var columns = new DbColumn[columnHeaders.Length];

            for (var i = 0; i < columnHeaders.Length; i++) {
                // Unquote headers
                var header = columnHeaders[i].Replace("\"", "");
                var splitHeader = header.Split(':');

                if (splitHeader.Length == 2) {
                    var columnName = splitHeader[0];
                    var typeHeader = splitHeader[1];

                    var mungType = MungType.Parse(typeHeader);

                    columns[i] = new DbColumn(columnName, mungType);
                } else {
                    columns[i] = new DbColumn(header, MungType.Get(MungTypeCode.String));

                }
            }
            _columns = columns.ToList();
        }
Пример #25
0
        private Sequence<InstructionNode> Create(IEnumerator<XamlInstruction> stream)
        {
            var nodes = new Sequence<InstructionNode>();

            while (IsLeading(stream.Current))
            {
                var currentNode = new InstructionNode { Leading = stream.Current };
                var continueWorking = true;
                while (stream.MoveNext() && continueWorking)
                {
                    if (IsLeading(stream.Current))
                    {
                        currentNode.Children = Create(stream);
                    }

                    var xamlNode = stream.Current;

                    if (IsTrailing(xamlNode))
                    {
                        continueWorking = false;
                        currentNode.Trailing = stream.Current;
                    }
                    else
                    {
                        currentNode.Body.Add(stream.Current);
                    }
                }

                nodes.Add(currentNode);
            }

            return nodes;
        }
Пример #26
0
 public EnumeratorSeq(IEnumerator enumerator)
 {
     _enumerator = enumerator;
     _state = new State();
     _state._val = _state;
     _state._rest = _state;
 }
 /// <summary>
 /// Parametrized constructor
 /// </summary>
 /// <param name="enumerator">enumerator that generates id for users(Fibonacci enumerator by default)</param>
 /// <param name="path">file path</param>
 public MemoryRepository(IEnumerator<int> enumerator, string path)
 {
     if (enumerator != null)
         _enumerator = enumerator;
     if (path != null)
         _xmlPath = path;
 }
Пример #28
0
    public void ShowLetter(int num)
    {
        if(currentCourutine != null)
        {
            StopCoroutine(currentCourutine);
            currentCourutine = null;
        }

        full.SetActive(true);
        letters[num].SetActive(true);
        letters[num].transform.localScale = new Vector3(4f, 4f, 4f);

        iTween.ScaleTo(letters[num].gameObject,
           iTween.Hash(
               "scale", new Vector3(1, 1, 1),
               "time", 0.45f,
              /* "onstart", (System.Action<object>)(newVal => logo1.color = new Color(logo1.color.r, logo1.color.g, logo1.color.b, 1)),*/
               "easetype", iTween.EaseType.easeInCubic,
               "oncomplete", "ShakeCamera",
               "oncompletetarget", gameObject
               )
            );

        currentCourutine = HideFull();
        StartCoroutine(currentCourutine);
    }
Пример #29
0
            public X509CertificateEnumerator(X509CertificateCollection mappings)
            {
                if (mappings == null)
                    throw new ArgumentNullException(nameof(mappings));

                _enumerator = ((IEnumerable)mappings).GetEnumerator();
            }
Пример #30
0
 /// Creates a new Task object for the given coroutine.
 ///
 /// If autoStart is true (default) the task is automatically started
 /// upon construction.
 public Task(IEnumerator c, bool autoStart = true)
 {
     task = TaskManager.CreateTask(c);
     task.Finished += TaskFinished;
     if (autoStart)
         Start();
 }
    public void SetQuest(int questID)
    {
        this.m_expiringSoon.get_gameObject().SetActive(false);
        this.m_questID = questID;
        Transform[] componentsInChildren = this.m_worldQuestObjectiveRoot.GetComponentsInChildren <Transform>(true);
        Transform[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Transform transform = array[i];
            if (transform != null && transform != this.m_worldQuestObjectiveRoot.get_transform())
            {
                Object.DestroyImmediate(transform.get_gameObject());
            }
        }
        MobileWorldQuest mobileWorldQuest = (MobileWorldQuest)WorldQuestData.worldQuestDictionary.get_Item(this.m_questID);
        GameObject       gameObject       = Object.Instantiate <GameObject>(this.m_worldQuestObjectiveDisplayPrefab);

        gameObject.get_transform().SetParent(this.m_worldQuestObjectiveRoot.get_transform(), false);
        Text component = gameObject.GetComponent <Text>();

        component.set_text(mobileWorldQuest.QuestTitle);
        component.set_resizeTextMaxSize(26);
        BountySite[] componentsInChildren2 = this.m_bountyLogoRoot.get_transform().GetComponentsInChildren <BountySite>(true);
        BountySite[] array2 = componentsInChildren2;
        for (int j = 0; j < array2.Length; j++)
        {
            BountySite bountySite = array2[j];
            Object.DestroyImmediate(bountySite.get_gameObject());
        }
        if (PersistentBountyData.bountiesByWorldQuestDictionary.ContainsKey(mobileWorldQuest.QuestID))
        {
            MobileBountiesByWorldQuest mobileBountiesByWorldQuest = (MobileBountiesByWorldQuest)PersistentBountyData.bountiesByWorldQuestDictionary.get_Item(mobileWorldQuest.QuestID);
            for (int k = 0; k < mobileBountiesByWorldQuest.BountyQuestID.Length; k++)
            {
                IEnumerator enumerator = PersistentBountyData.bountyDictionary.get_Values().GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        MobileWorldQuestBounty mobileWorldQuestBounty = (MobileWorldQuestBounty)enumerator.get_Current();
                        if (mobileBountiesByWorldQuest.BountyQuestID[k] == mobileWorldQuestBounty.QuestID)
                        {
                            QuestV2Rec record = StaticDB.questDB.GetRecord(mobileWorldQuestBounty.QuestID);
                            if (record != null)
                            {
                                GameObject gameObject2 = Object.Instantiate <GameObject>(this.m_worldQuestObjectiveDisplayPrefab);
                                gameObject2.get_transform().SetParent(this.m_worldQuestObjectiveRoot.get_transform(), false);
                                this.m_worldQuestTimeText = gameObject2.GetComponent <Text>();
                                this.m_worldQuestTimeText.set_text(record.QuestTitle);
                                this.m_worldQuestTimeText.set_horizontalOverflow(1);
                                this.m_worldQuestTimeText.set_color(new Color(1f, 0.773f, 0f, 1f));
                                BountySite bountySite2 = Object.Instantiate <BountySite>(this.m_bountyLogoPrefab);
                                bountySite2.SetBounty(mobileWorldQuestBounty);
                                bountySite2.get_transform().SetParent(this.m_bountyLogoRoot.get_transform(), false);
                            }
                        }
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
        }
        GameObject gameObject3 = Object.Instantiate <GameObject>(this.m_worldQuestObjectiveDisplayPrefab);

        gameObject3.get_transform().SetParent(this.m_worldQuestObjectiveRoot.get_transform(), false);
        this.m_worldQuestTimeText = gameObject3.GetComponent <Text>();
        this.m_worldQuestTimeText.set_text(mobileWorldQuest.QuestTitle);
        this.m_worldQuestTimeText.set_horizontalOverflow(1);
        this.m_worldQuestTimeText.set_color(new Color(1f, 0.773f, 0f, 1f));
        using (IEnumerator <MobileWorldQuestObjective> enumerator2 = Enumerable.AsEnumerable <MobileWorldQuestObjective>(mobileWorldQuest.Objective).GetEnumerator())
        {
            while (enumerator2.MoveNext())
            {
                MobileWorldQuestObjective current = enumerator2.get_Current();
                GameObject gameObject4            = Object.Instantiate <GameObject>(this.m_worldQuestObjectiveDisplayPrefab);
                gameObject4.get_transform().SetParent(this.m_worldQuestObjectiveRoot.get_transform(), false);
                Text component2 = gameObject4.GetComponent <Text>();
                component2.set_text("-" + current.Text);
            }
        }
        this.InitRewardInfoDisplay(mobileWorldQuest);
        this.m_endTime = (long)(mobileWorldQuest.EndTime - 900);
        QuestInfoRec record2 = StaticDB.questInfoDB.GetRecord(mobileWorldQuest.QuestInfoID);

        if (record2 == null)
        {
            return;
        }
        bool active = (record2.Modifiers & 2) != 0;

        this.m_dragonFrame.get_gameObject().SetActive(active);
        this.m_background.set_sprite(Resources.Load <Sprite>("NewWorldQuest/Mobile-NormalQuest"));
        bool flag = (record2.Modifiers & 1) != 0;

        if (flag && record2.Type != 3)
        {
            this.m_background.set_sprite(Resources.Load <Sprite>("NewWorldQuest/Mobile-RareQuest"));
        }
        bool flag2 = (record2.Modifiers & 4) != 0;

        if (flag2 && record2.Type != 3)
        {
            this.m_background.set_sprite(Resources.Load <Sprite>("NewWorldQuest/Mobile-EpicQuest"));
        }
        int    uITextureAtlasMemberID;
        string text;

        switch (record2.Type)
        {
        case 1:
        {
            int profession = record2.Profession;
            switch (profession)
            {
            case 182:
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-herbalism");
                text = "Mobile-Herbalism";
                goto IL_6CB;

            case 183:
            case 184:
IL_4B6:
                if (profession == 164)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-blacksmithing");
                    text = "Mobile-Blacksmithing";
                    goto IL_6CB;
                }
                if (profession == 165)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-leatherworking");
                    text = "Mobile-Leatherworking";
                    goto IL_6CB;
                }
                if (profession == 129)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-firstaid");
                    text = "Mobile-FirstAid";
                    goto IL_6CB;
                }
                if (profession == 171)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-alchemy");
                    text = "Mobile-Alchemy";
                    goto IL_6CB;
                }
                if (profession == 197)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-tailoring");
                    text = "Mobile-Tailoring";
                    goto IL_6CB;
                }
                if (profession == 202)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-engineering");
                    text = "Mobile-Engineering";
                    goto IL_6CB;
                }
                if (profession == 333)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-enchanting");
                    text = "Mobile-Enchanting";
                    goto IL_6CB;
                }
                if (profession == 356)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-fishing");
                    text = "Mobile-Fishing";
                    goto IL_6CB;
                }
                if (profession == 393)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-skinning");
                    text = "Mobile-Skinning";
                    goto IL_6CB;
                }
                if (profession == 755)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-jewelcrafting");
                    text = "Mobile-Jewelcrafting";
                    goto IL_6CB;
                }
                if (profession == 773)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-inscription");
                    text = "Mobile-Inscription";
                    goto IL_6CB;
                }
                if (profession != 794)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-questmarker-questbang");
                    text = "Mobile-QuestExclamationIcon";
                    goto IL_6CB;
                }
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-archaeology");
                text = "Mobile-Archaeology";
                goto IL_6CB;

            case 185:
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-cooking");
                text = "Mobile-Cooking";
                goto IL_6CB;

            case 186:
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-mining");
                text = "Mobile-Mining";
                goto IL_6CB;
            }
            goto IL_4B6;
IL_6CB:
            goto IL_718;
        }

        case 3:
            uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-pvp-ffa");
            text = "Mobile-PVP";
            goto IL_718;

        case 4:
            uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-petbattle");
            text = "Mobile-Pets";
            goto IL_718;
        }
        uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-questmarker-questbang");
        text = "Mobile-QuestExclamationIcon";
IL_718:
        if (text != null)
        {
            this.m_main.set_sprite(Resources.Load <Sprite>("NewWorldQuest/" + text));
        }
        else if (uITextureAtlasMemberID > 0)
        {
            this.m_main.set_sprite(TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID));
            this.m_main.SetNativeSize();
        }
        this.UpdateTimeRemaining();
    }
Пример #32
0
        internal PermissionSet CodeGroupResolve (Evidence evidence, bool systemPolicy) {
            Contract.Assert(AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled);

            PermissionSet grant = null;
            PolicyStatement policy;
            PolicyLevel currentLevel = null;

            IEnumerator levelEnumerator = PolicyLevels.GetEnumerator();

            // We're optimized for standard policy, where the only evidence that is generally evaluated are
            // Zone, StrongName and Url.  Since all of these are relatively inexpensive, we'll force them to
            // generate, then use that as a key into the cache.
            evidence.GetHostEvidence<Zone>();
            evidence.GetHostEvidence<StrongName>();
            evidence.GetHostEvidence<Url>();
            byte[] serializedEvidence = evidence.RawSerialize();
            int count = evidence.RawCount;

            bool legacyIgnoreSystemPolicy = (AppDomain.CurrentDomain.GetData("IgnoreSystemPolicy") != null);
            bool testApplicationLevels = false;
            while (levelEnumerator.MoveNext())
            {
                currentLevel = (PolicyLevel)levelEnumerator.Current;
                if (systemPolicy) {
                    if (currentLevel.Type == PolicyLevelType.AppDomain)
                        continue;
                } else if (legacyIgnoreSystemPolicy && currentLevel.Type != PolicyLevelType.AppDomain)
                    continue;

                policy = currentLevel.Resolve(evidence, count, serializedEvidence);

                // If the grant is "AllPossible", the intersection is just the other permission set.
                // Otherwise, do an inplace intersection (since we know we can alter the grant set since
                // it is a copy of the first policy statement's permission set).

                if (grant == null)
                    grant = policy.PermissionSet;
                else
                    grant.InplaceIntersect(policy.GetPermissionSetNoCopy());

                if (grant == null || grant.FastIsEmpty())
                {
                    break;
                }
                else if ((policy.Attributes & PolicyStatementAttribute.LevelFinal) == PolicyStatementAttribute.LevelFinal)
                {
                    if (currentLevel.Type != PolicyLevelType.AppDomain)
                    {
                        testApplicationLevels = true;
                    }
                    break;
                }
            }

            if (grant != null && testApplicationLevels)
            {
                PolicyLevel appDomainLevel = null;

                for (int i = PolicyLevels.Count - 1; i >= 0; --i)
                {
                    currentLevel = (PolicyLevel) PolicyLevels[i];
                    if (currentLevel.Type == PolicyLevelType.AppDomain)
                    {
                        appDomainLevel = currentLevel;
                        break;
                    }
                }

                if (appDomainLevel != null)
                {
                    policy = appDomainLevel.Resolve(evidence, count, serializedEvidence);
                    grant.InplaceIntersect(policy.GetPermissionSetNoCopy());
                }
            }

            if (grant == null)
                grant = new PermissionSet(PermissionState.None);

            // Each piece of evidence can possibly create an identity permission that we
            // need to add to our grant set.  Therefore, for all pieces of evidence that
            // implement the IIdentityPermissionFactory interface, ask it for its
            // adjoining identity permission and add it to the grant.

            if (!grant.IsUnrestricted())
            {
                IEnumerator enumerator = evidence.GetHostEnumerator();
                while (enumerator.MoveNext())
                {
                    Object obj = enumerator.Current;
                    IIdentityPermissionFactory factory = obj as IIdentityPermissionFactory;
                    if (factory != null)
                    {
                        IPermission perm = factory.CreateIdentityPermission( evidence );
                        if (perm != null)
                            grant.AddPermission( perm );
                    }
                }
            }

            grant.IgnoreTypeLoadFailures = true;
            return grant;
        }
Пример #33
0
      /// <summary>
      /// Inquire an geometry element to get all face instances
      /// </summary>
      /// <param name="geoElement">the geometry element</param>
      /// <param name="elem">the element, it provides the prefix of face name</param>
      /// <returns></returns>
      private bool InquireGeometry(GeoElement geoElement, RevitElement elem)
      {
         if (null == geoElement || null == elem)
         {
            return false;
         }

         //GeometryObjectArray geoArray = null;
         IEnumerator<GeometryObject> Objects = geoElement.GetEnumerator();
         //if (null != geoElement && null != geoElement.Objects)
         if (null != geoElement && Objects.MoveNext())
         {
            //geoArray = geoElement.Objects;
         }
         else
         {
            return false;
         }

         Objects.Reset();
         //foreach (GeometryObject obj in geoArray)
         while (Objects.MoveNext())
         {
            GeometryObject obj = Objects.Current;

            if (obj is GeoInstance)
            {
               GeoInstance instance = (GeoInstance)obj;
               InquireGeometry(instance.SymbolGeometry, elem);
            }
            else if (!(obj is Solid))
            {
               // is not Solid instance
               continue;
            }

            // continue when obj is Solid instance
            Solid solid = obj as Solid;
            if (null == solid)
            {
               continue;
            }
            FaceArray faces = solid.Faces;
            if (faces.IsEmpty)
            {
               continue;
            }

            // get the face name list
            String category = String.Empty;
            if (null != elem.Category && null != elem.Name)
            {
               category = elem.Category.Name;
            }

            int ii = 0;
            foreach (Face tempFace in faces)
            {
               if (tempFace is PlanarFace)
               {
                  m_faceNameList.Add(
                      String.Format("{0} : {1} ({2})", category, elem.Name, ii));
                  m_faceList.Add(tempFace);
                  ii++;
               }
            }
         }
         return true;
      }
 // A custom DataReader is implemented to prevent the need for the HashSet to be transformed to a DataTable for loading by SqlBulkCopy
 public VisitOccurrenceDataReader(List <VisitOccurrence> batch, KeyMasterOffsetManager o)
 {
     _enumerator = batch?.GetEnumerator();
     _offset     = o;
 }
        public void Verify()
        {
            Assert.Equal((short)1, MyInt16);
            Assert.Equal((int)2, MyInt32);
            Assert.Equal((long)3, MyInt64);
            Assert.Equal((ushort)4, MyUInt16);
            Assert.Equal((uint)5, MyUInt32);
            Assert.Equal((ulong)6, MyUInt64);
            Assert.Equal((byte)7, MyByte);
            Assert.Equal((sbyte)8, MySByte);
            Assert.Equal('a', MyChar);
            Assert.Equal("Hello", MyString);
            Assert.Equal(3.3m, MyDecimal);
            Assert.False(MyBooleanFalse);
            Assert.True(MyBooleanTrue);
            Assert.Equal(1.1f, MySingle);
            Assert.Equal(2.2d, MyDouble);
            Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTime);
            Assert.Equal(new DateTimeOffset(2019, 1, 30, 12, 1, 2, new TimeSpan(1, 0, 0)), MyDateTimeOffset);
            Assert.Equal(new Guid("1B33498A-7B7D-4DDA-9C13-F6AA4AB449A6"), MyGuid);
            Assert.Equal(new Uri("https://github.com/dotnet/corefx"), MyUri);
            Assert.Equal(SampleEnum.Two, MyEnum);
            Assert.Equal(SampleEnumInt64.MinNegative, MyInt64Enum);
            Assert.Equal(SampleEnumUInt64.Max, MyUInt64Enum);
            Assert.Equal(11, MySimpleStruct.One);
            Assert.Equal(1.9999, MySimpleStruct.Two);
            Assert.Equal(64, MySimpleTestStruct.MyInt64);
            Assert.Equal("Hello", MySimpleTestStruct.MyString);
            Assert.Equal(32, MySimpleTestStruct.MyInt32Array[0]);

            Assert.Equal((short)1, MyInt16Array[0]);
            Assert.Equal((int)2, MyInt32Array[0]);
            Assert.Equal((long)3, MyInt64Array[0]);
            Assert.Equal((ushort)4, MyUInt16Array[0]);
            Assert.Equal((uint)5, MyUInt32Array[0]);
            Assert.Equal((ulong)6, MyUInt64Array[0]);
            Assert.Equal((byte)7, MyByteArray[0]);
            Assert.Equal((sbyte)8, MySByteArray[0]);
            Assert.Equal('a', MyCharArray[0]);
            Assert.Equal("Hello", MyStringArray[0]);
            Assert.Equal(3.3m, MyDecimalArray[0]);
            Assert.False(MyBooleanFalseArray[0]);
            Assert.True(MyBooleanTrueArray[0]);
            Assert.Equal(1.1f, MySingleArray[0]);
            Assert.Equal(2.2d, MyDoubleArray[0]);
            Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeArray[0]);
            Assert.Equal(new DateTimeOffset(2019, 1, 30, 12, 1, 2, new TimeSpan(1, 0, 0)), MyDateTimeOffsetArray[0]);
            Assert.Equal(new Guid("1B33498A-7B7D-4DDA-9C13-F6AA4AB449A6"), MyGuidArray[0]);
            Assert.Equal(new Uri("https://github.com/dotnet/corefx"), MyUriArray[0]);
            Assert.Equal(SampleEnum.Two, MyEnumArray[0]);

            Assert.Equal(10, MyInt16TwoDimensionArray[0][0]);
            Assert.Equal(11, MyInt16TwoDimensionArray[0][1]);
            Assert.Equal(20, MyInt16TwoDimensionArray[1][0]);
            Assert.Equal(21, MyInt16TwoDimensionArray[1][1]);

            Assert.Equal(10, MyInt16TwoDimensionList[0][0]);
            Assert.Equal(11, MyInt16TwoDimensionList[0][1]);
            Assert.Equal(20, MyInt16TwoDimensionList[1][0]);
            Assert.Equal(21, MyInt16TwoDimensionList[1][1]);

            Assert.Equal(11, MyInt16ThreeDimensionArray[0][0][0]);
            Assert.Equal(12, MyInt16ThreeDimensionArray[0][0][1]);
            Assert.Equal(13, MyInt16ThreeDimensionArray[0][1][0]);
            Assert.Equal(14, MyInt16ThreeDimensionArray[0][1][1]);
            Assert.Equal(21, MyInt16ThreeDimensionArray[1][0][0]);
            Assert.Equal(22, MyInt16ThreeDimensionArray[1][0][1]);
            Assert.Equal(23, MyInt16ThreeDimensionArray[1][1][0]);
            Assert.Equal(24, MyInt16ThreeDimensionArray[1][1][1]);

            Assert.Equal(11, MyInt16ThreeDimensionList[0][0][0]);
            Assert.Equal(12, MyInt16ThreeDimensionList[0][0][1]);
            Assert.Equal(13, MyInt16ThreeDimensionList[0][1][0]);
            Assert.Equal(14, MyInt16ThreeDimensionList[0][1][1]);
            Assert.Equal(21, MyInt16ThreeDimensionList[1][0][0]);
            Assert.Equal(22, MyInt16ThreeDimensionList[1][0][1]);
            Assert.Equal(23, MyInt16ThreeDimensionList[1][1][0]);
            Assert.Equal(24, MyInt16ThreeDimensionList[1][1][1]);

            Assert.Equal("Hello", MyStringList[0]);

            IEnumerator enumerator = MyStringIEnumerable.GetEnumerator();

            enumerator.MoveNext();
            {
                // Verifying after deserialization.
                if (enumerator.Current is JsonElement currentJsonElement)
                {
                    Assert.Equal("Hello", currentJsonElement.GetString());
                }
                // Verifying test data.
                else
                {
                    Assert.Equal("Hello", enumerator.Current);
                }
            }

            {
                // Verifying after deserialization.
                if (MyStringIList[0] is JsonElement currentJsonElement)
                {
                    Assert.Equal("Hello", currentJsonElement.GetString());
                }
                // Verifying test data.
                else
                {
                    Assert.Equal("Hello", enumerator.Current);
                }
            }

            enumerator = MyStringICollection.GetEnumerator();
            enumerator.MoveNext();
            {
                // Verifying after deserialization.
                if (enumerator.Current is JsonElement currentJsonElement)
                {
                    Assert.Equal("Hello", currentJsonElement.GetString());
                }
                // Verifying test data.
                else
                {
                    Assert.Equal("Hello", enumerator.Current);
                }
            }

            Assert.Equal("Hello", MyStringIEnumerableT.First());
            Assert.Equal("Hello", MyStringIListT[0]);
            Assert.Equal("Hello", MyStringICollectionT.First());
            Assert.Equal("Hello", MyStringIReadOnlyCollectionT.First());
            Assert.Equal("Hello", MyStringIReadOnlyListT[0]);
            Assert.Equal("Hello", MyStringISetT.First());

            enumerator = MyStringToStringIDict.GetEnumerator();
            enumerator.MoveNext();
            {
                // Verifying after deserialization.
                if (enumerator.Current is JsonElement currentJsonElement)
                {
                    IEnumerator jsonEnumerator = currentJsonElement.EnumerateObject();
                    jsonEnumerator.MoveNext();

                    JsonProperty property = (JsonProperty)jsonEnumerator.Current;

                    Assert.Equal("key", property.Name);
                    Assert.Equal("value", property.Value.GetString());
                }
                // Verifying test data.
                else
                {
                    DictionaryEntry entry = (DictionaryEntry)enumerator.Current;
                    Assert.Equal("key", entry.Key);

                    if (entry.Value is JsonElement element)
                    {
                        Assert.Equal("value", element.GetString());
                    }
                    else
                    {
                        Assert.Equal("value", entry.Value);
                    }
                }
            }

            Assert.Equal("value", MyStringToStringGenericDict["key"]);
            Assert.Equal("value", MyStringToStringGenericIDict["key"]);
            Assert.Equal("value", MyStringToStringGenericIReadOnlyDict["key"]);

            Assert.Equal("value", MyStringToStringImmutableDict["key"]);
            Assert.Equal("value", MyStringToStringIImmutableDict["key"]);
            Assert.Equal("value", MyStringToStringImmutableSortedDict["key"]);

            Assert.Equal("myKey", MyStringToStringKeyValuePair.Key);
            Assert.Equal("myValue", MyStringToStringKeyValuePair.Value);

            Assert.Equal(2, MyStringStackT.Count);
            Assert.True(MyStringStackT.Contains("Hello"));
            Assert.True(MyStringStackT.Contains("World"));

            string[] expectedQueue = { "Hello", "World" };
            int      i             = 0;

            foreach (string item in MyStringQueueT)
            {
                Assert.Equal(expectedQueue[i], item);
                i++;
            }

            Assert.Equal("Hello", MyStringHashSetT.First());
            Assert.Equal("Hello", MyStringLinkedListT.First());
            Assert.Equal("Hello", MyStringSortedSetT.First());

            Assert.Equal("Hello", MyStringIImmutableListT[0]);
            Assert.Equal("Hello", MyStringIImmutableStackT.First());
            Assert.Equal("Hello", MyStringIImmutableQueueT.First());
            Assert.Equal("Hello", MyStringIImmutableSetT.First());
            Assert.Equal("Hello", MyStringImmutableHashSetT.First());
            Assert.Equal("Hello", MyStringImmutableListT[0]);
            Assert.Equal("Hello", MyStringImmutableStackT.First());
            Assert.Equal("Hello", MyStringImmutablQueueT.First());
            Assert.Equal("Hello", MyStringImmutableSortedSetT.First());

            Assert.Null(MyListOfNullString[0]);
        }
Пример #36
0
        /// <summary>
        /// Get the latest content from the web site at most once every 24 hours
        /// </summary>
        /// <returns>Enumerator</returns>
        IEnumerator GetRemoteUpdate()
        {
#if UNITY_2018_3_OR_NEWER
            using (UnityWebRequest www = UnityWebRequest.Get(URL))
            {
                yield return(www.SendWebRequest());

                if (www.isNetworkError || www.isHttpError)
                {
                    Debug.Log(www.error);
                }
                else
                {
                    try
                    {
                        string result = www.downloadHandler.text;
#else
            using (WWW www = new WWW(URL))
            {
                while (!www.isDone)
                {
                    yield return(www);
                }

                if (!string.IsNullOrEmpty(www.error))
                {
                    Debug.Log(www.error);
                }
                else
                {
                    try
                    {
                        string result = www.text;
#endif
                        int first = result.IndexOf("####");
                        if (first > 0)
                        {
                            result = result.Substring(first + 10);
                            first  = result.IndexOf("####");
                            if (first > 0)
                            {
                                result = result.Substring(0, first);
                                result = result.Replace("<br />", "");
                                result = result.Replace("&#8221;", "\"");
                                result = result.Replace("&#8220;", "\"");
                                m_downloadCompleteCallback(JsonUtility.FromJson <PWMessage>(result));

                                //Debug.Log(result);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.Log(e.Message);
                    }
                }
            }
            m_updateCoroutine = null;
        }
    }
}
Пример #37
0
 public static void StartCoroutine(IEnumerator enumerator)
 {
     ((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(enumerator);
 }
	private void ControlPlayerRunTime(){

		if (Input.GetKeyDown (KeyCode.Escape)) {
			Cursor.visible = true;
			Cursor.lockState = CursorLockMode.None; 
		}
		//MovePlayer();
		CheckRayCast ();
		//Glitch Torch
		//ControlTorchLight();

		Frame frame = leapProvider.CurrentFrame;

		foreach (Hand hand in frame.Hands) {
			if (hand.IsLeft) {
				if (!AttachmentHands.activeSelf)
					AttachmentHands.SetActive (true);
				if (!hand.Fingers [0].IsExtended && !hand.Fingers [1].IsExtended && !hand.Fingers [2].IsExtended && !hand.Fingers [3].IsExtended && !hand.Fingers [4].IsExtended) {
					//Fermati
					RUN = false;
                    StopStepsSound();
                } else {
					//Cammina verso dove si guarda.
					if (hand.Fingers [0].IsExtended && hand.Fingers [1].IsExtended && hand.Fingers [2].IsExtended && hand.Fingers [3].IsExtended && hand.Fingers [4].IsExtended) {
						if (this.PALM_FACE_BACKWARD) {
							RUN = true;
                            //suona lo step sull'erba o su marmo a seconda di dove è il player
                            PlayStepsSound();                  
						} else {
							RUN = false;
                            StopStepsSound();
                        }
					}
				}
			}
			if (hand.IsRight) {
				//Pollice in su, attiva modalità arma.
				if (hand.Fingers [0].IsExtended && !hand.Fingers [1].IsExtended && !hand.Fingers [2].IsExtended && !hand.Fingers [3].IsExtended && !hand.Fingers [4].IsExtended) {
					if (!WeaponRight.GetComponentInChildren<MeshRenderer> ().isVisible && !TriggerWeapon && Started) {
						TriggerWeapon = true;
						CoroutineWeapon = ShowWeapon (2f);
						StartCoroutine (CoroutineWeapon);
					}
				} else {
					if(CoroutineWeapon != null)
						StopCoroutine (CoroutineWeapon);
					TriggerWeapon = false;
					WeaponAppear = false;
					WeaponRight.SetActive (false);
					CoroutineWeapon = null;
				}
			}
		}

		//Se non ci sono mani identificate allora setto a false l'arma.
		if (frame.Hands.Count != 0) {	
			if (WeaponAppear && TriggerWeapon) {
				WeaponRight.SetActive (true);
			}
		} else {
			if(CoroutineWeapon != null)
				StopCoroutine (CoroutineWeapon);
			CoroutineWeapon = null;
			TriggerWeapon = false;
			WeaponAppear = false;
			AttachmentHands.SetActive (false);
		}

		//Controllo sul moviemento
		if (!this.PALM_FACE_BACKWARD)
			RUN = false;
		//Muovo il player usando il Leap.
		MovePlayerUsingLeap ();	
	}
Пример #39
0
 public DataViewReader(DataView dataSource, CancellationToken cancelToken)
 {
     _DataSource  = dataSource ?? throw new ArgumentNullException(nameof(dataSource));
     _Enumerator  = _DataSource.GetEnumerator();
     _CancelToken = cancelToken;
 }
Пример #40
0
 public TaskState(IEnumerator c)
 {
     coroutine = c;
 }
Пример #41
0
 public virtual void Reset()
 {
     _iterator = null;
     _current  = MoveNextMarker;
 }
Пример #42
0
		public EnumeratorBase(IEnumerator en)
		{
			this.en = en;
		}
Пример #43
0
 public static void DoYieldCoroutine(IEnumerator routine)
 {
     _CoroutineManagerMonoBehaviour.StartCoroutine(yieldRoutine(routine));
 }
Пример #44
0
 public EnumerableWithCounter(IEnumerable<T> enumerable, int index = -1)
 {
     _enumerator = enumerable.GetEnumerator();
     _index = index;
 }
Пример #45
0
 public EnumeratedIterator(IEnumerator iterator)
 {
     i = iterator;
 }
Пример #46
0
 private static IEnumerator yieldRoutine(IEnumerator routine)
 {
     yield return(_CoroutineManagerMonoBehaviour.StartCoroutine(routine));
 }
Пример #47
0
 // A custom DataReader is implemented to prevent the need for the HashSet to be transformed to a DataTable for loading by SqlBulkCopy
 public NoteDataReader52(List <Note> batch, KeyMasterOffsetManager o)
 {
     _enumerator = batch?.GetEnumerator();
     _offset     = o;
 }
Пример #48
0
 public static Coroutine DoCoroutine(IEnumerator routine)
 {
     return(_CoroutineManagerMonoBehaviour.StartCoroutine(routine));
 }
Пример #49
0
 public AsyncEnumeratorBridge(IEnumerator <T> enumerator)
 {
     this.enumerator = enumerator;
 }
Пример #50
0
        public void MeasureDeffactTest()
        {
            ArrayList objects = new ArrayList();
            // Runtime rt = Runtime.getRuntime();
            long total1 = GC.GetTotalMemory(true);
            //long free1 = rt.freeMemory();
            //long used1 = total1 - free1;
            int count = 50000;

            Console.WriteLine("Used memory before creating objects " + total1 + " bytes " +
                              (total1 / 1024) + " Kb");
            for (int idx = 0; idx < count; idx++)
            {
                Account acc = new Account();
                acc.AccountId   = Convert.ToString(ran.Next(100000));
                acc.AccountType = Convert.ToString(ran.Next(100000));
                acc.First       = Convert.ToString(ran.Next(100000));
                acc.Last        = Convert.ToString(ran.Next(100000));
                acc.Middle      = Convert.ToString(ran.Next(100000));
                acc.OfficeCode  = Convert.ToString(ran.Next(100000));
                acc.RegionCode  = Convert.ToString(ran.Next(100000));
                acc.Status      = Convert.ToString(ran.Next(100000));
                acc.Title       = Convert.ToString(ran.Next(100000));
                acc.Username    = Convert.ToString(ran.Next(100000));
                acc.AreaCode    = Convert.ToString(ran.Next(999));
                acc.Exchange    = Convert.ToString(ran.Next(999));
                acc.Number      = Convert.ToString(ran.Next(999));
                acc.Ext         = Convert.ToString(ran.Next(9999));
                objects.Add(acc);
            }
            long total2 = GC.GetTotalMemory(true);

            //long free2 = rt.freeMemory();
            //long used2 = total2 - free2;
            Console.WriteLine("Used memory after creating objects " + total2 + " bytes " +
                              (total2 / 1024) + " Kb " + (total2 / 1024 / 1024) + " Mb");
            Rete engine = new Rete();

            engine.declareObject(typeof(Account));
            IEnumerator itr   = objects.GetEnumerator();
            long        start = DateTime.Now.Ticks;

            try
            {
                while (itr.MoveNext())
                {
                    engine.assertObject(itr.Current, null, false, false);
                }
            }
            catch (AssertException e)
            {
                Console.WriteLine(e.Message);
            }
            long end    = DateTime.Now.Ticks;
            long total3 = GC.GetTotalMemory(true);

            //long free3 = rt.freeMemory();
            //long used3 = total3 - free3;
            //rt.gc();
            Console.WriteLine("Used memory after asserting objects " + total3 + " bytes " +
                              (total3 / 1024) + " Kb " + (total3 / 1024 / 1024) + " Mb");
            Console.WriteLine("number of facts " + engine.ObjectCount);
            Console.WriteLine("memory used by facts " + (total3 - total3) / 1024 / 1024 + " Mb");
            Console.WriteLine("elapsed time is " + (end - start) + " ms");
            engine.close();
        }
Пример #51
0
 void Awake()
 {
     _spawnCoroutine = AddBallWithDelay(BallPrefab);
 }
        /// <summary>
        /// Start a co-routine function.
        /// </summary>
        /// <param name="routine">The IEnumerator returns by the co-routine function the user is invoking.</param>
        /// <returns>Returns a ID that can be passed into Stop() to halt the co-routine.</returns>
        public static int Run(IEnumerator routine)
        {
            Routine r = new Routine(routine);

            return(r.ID);
        }
Пример #53
0
 public static Coroutine Start(IEnumerator routine)
 {
     return(Instance.StartCoroutine(routine));
 }
        public override IEnumerator BuildTile(IDictionary mapData, GOLayer layer, bool delayedLoad)
        {
            GameObject parent = new GameObject();

            parent.name             = layer.name;
            parent.transform.parent = this.transform;
            parent.SetActive(!layer.startInactive);

            if (mapData == null)
            {
                Debug.LogWarning("Map Data is null!");
                FileHandler.Remove(gameObject.name);
                yield break;
            }

            IList features = (IList)mapData ["features"];


            if (features == null)
            {
                yield break;
            }

            IList stack = new List <GOFeature> ();

            foreach (IDictionary geo in features)
            {
                IDictionary geometry   = (IDictionary)geo ["geometry"];
                IDictionary properties = (IDictionary)geo ["properties"];
                string      type       = (string)geometry ["type"];

                string kind = (string)properties ["kind"];
                if (properties.Contains("kind_detail"))
                {
                    kind = (string)properties ["kind_detail"];
                }

                var id = properties ["id"];
                if (idCheck(id, layer) == false && layer.layerType == GOLayer.GOLayerType.Buildings)
                {
                    continue;
                }

                if (layer.useOnly.Length > 0 && !layer.useOnly.Contains(GOEnumUtils.MapzenToKind(kind)))
                {
                    continue;
                }
                if (layer.avoid.Length > 0 && layer.avoid.Contains(GOEnumUtils.MapzenToKind(kind)))
                {
                    continue;
                }

                if (type == "MultiLineString" || (type == "Polygon" && !layer.isPolygon))
                {
                    IList lines = new List <object>();
                    lines = (IList)geometry ["coordinates"];
                    foreach (IList coordinates in lines)
                    {
                        GOFeature gf = ParseFeatureData(properties, layer);
                        gf.geometry = coordinates;
//						gf.type = type;
                        gf.layer      = layer;
                        gf.parent     = parent;
                        gf.properties = properties;
                        gf.ConvertGeometries();
                        gf.ConvertAttributes();
                        gf.featureIndex  = (Int64)features.IndexOf(geo);
                        gf.goFeatureType = GOFeatureType.MultiLine;
                        stack.Add(gf);
                    }
                }

                else if (type == "LineString")
                {
                    IList     coordinates = (IList)geometry ["coordinates"];
                    GOFeature gf          = ParseFeatureData(properties, layer);
                    gf.geometry = coordinates;
//					gf.type = type;
                    gf.layer      = layer;
                    gf.parent     = parent;
                    gf.properties = properties;
                    gf.ConvertGeometries();
                    gf.ConvertAttributes();
                    gf.featureIndex  = (Int64)features.IndexOf(geo);
                    gf.goFeatureType = GOFeatureType.Line;
                    stack.Add(gf);
                }

                else if (type == "Polygon")
                {
                    List <object> shapes = new List <object>();
                    shapes = (List <object>)geometry["coordinates"];

                    IList         subject = null;
                    List <object> clips   = null;
                    if (shapes.Count == 1)
                    {
                        subject = (List <object>)shapes[0];
                    }
                    else if (shapes.Count > 1)
                    {
                        subject = (List <object>)shapes[0];
                        clips   = shapes.GetRange(1, shapes.Count - 1);
                    }
                    else
                    {
                        continue;
                    }

                    GOFeature gf = ParseFeatureData(properties, layer);
                    gf.geometry = subject;
                    gf.clips    = clips;
//					gf.type = type;
                    gf.layer      = layer;
                    gf.parent     = parent;
                    gf.properties = properties;
                    gf.ConvertGeometries();
                    gf.ConvertAttributes();
                    gf.featureIndex  = (Int64)features.IndexOf(geo);
                    gf.goFeatureType = GOFeatureType.Polygon;
                    stack.Add(gf);
                }

                if (type == "MultiPolygon")
                {
                    GameObject multi = new GameObject("MultiPolygon");
                    multi.transform.parent = parent.transform;

                    IList shapes = new List <object>();
                    shapes = (IList)geometry["coordinates"];

                    foreach (List <object> polygon in shapes)
                    {
                        IList         subject = null;
                        List <object> clips   = null;
                        if (polygon.Count > 0)
                        {
                            subject = (List <object>)polygon[0];
                        }
                        else if (polygon.Count > 1)
                        {
                            clips = polygon.GetRange(1, polygon.Count - 1);
                        }
                        else
                        {
                            continue;
                        }

                        GOFeature gf = ParseFeatureData(properties, layer);
                        gf.geometry = subject;
                        gf.clips    = clips;
//						gf.type = type;
                        gf.layer      = layer;
                        gf.parent     = parent;
                        gf.properties = properties;
                        gf.ConvertGeometries();
                        gf.ConvertAttributes();
                        gf.featureIndex  = (Int64)features.IndexOf(geo);
                        gf.goFeatureType = GOFeatureType.MultiPolygon;

                        stack.Add(gf);
                    }
                }
            }

//			if (layer.layerType == GOLayer.GOLayerType.Roads) {
//				stack = GORoadFeature.MergeRoads (stack);
//			}
//
            int n = 25;

            for (int i = 0; i < stack.Count; i += n)
            {
                for (int k = 0; k < n; k++)
                {
                    if (i + k >= stack.Count)
                    {
                        yield return(null);

                        break;
                    }

                    GOFeature r = (GOFeature)stack [i + k];
                    r.setRenderingOptions();
                    IEnumerator routine = r.BuildFeature(this, delayedLoad);
                    if (routine != null)
                    {
                        if (Application.isPlaying)
                        {
                            StartCoroutine(routine);
                        }
                        else
                        {
                            GORoutine.start(routine, this);
                        }
                    }
                }
                yield return(null);
            }

            yield return(null);
        }
Пример #55
0
 public static byte[] Decode(IEnumerator <Frame> iterator)
 {
     return(Decode(iterator.Take()));
 }
Пример #56
0
 public static void Stop(IEnumerator routine)
 {
     Instance.StopCoroutine(routine);
 }
    // Start a coroutine and stop an existing coroutine if necessary
    public static Coroutine OverrideCoroutine(this MonoBehaviour mono, ref Coroutine coroutine, IEnumerator ienumerator)
    {
        if (coroutine != null)
        {
            mono.StopCoroutine(coroutine);
        }

        return(coroutine = mono.StartCoroutine(ienumerator));
    }
Пример #58
0
 public Enumerator(LinkedList <KeyValuePair <TKey, TValue> > link)
 {
     enu = link.GetEnumerator();
 }
Пример #59
0
 public void Reset()
 {
     _index                 = 0;
     _moveNextDoc           = true;
     _currentFuncEnumerator = null;
 }
Пример #60
0
 public FilterEnumerator(IEnumerator <T> enumerator, Func <T, bool> filter)
 {
     _enumerator = enumerator;
     _filter     = filter;
 }