コード例 #1
0
    public bool HasAcceptablePosition()
    {
        if (isCollidingWithOtherUnit())
        {
            return(false);
        }
        Coordination coordination = GetCoordination();

        if (coordination.x <= 0 || coordination.y <= 0 || coordination.x > 7 || coordination.y > 7)
        {
            return(false);
        }
        if (Orientation == 1 && coordination.y - 1 + Size <= 7)
        {
            return(true);
        }
        if (Orientation == 2 && coordination.x - Size >= 0)
        {
            return(true);
        }
        if (Orientation == 3 && coordination.y - Size >= 0)
        {
            return(true);
        }
        if (Orientation == 4 && coordination.x - 1 + Size <= 7)
        {
            return(true);
        }

        return(false);
    }
コード例 #2
0
    private void DrawShootImpact(ShootImpactDto shootImpactDto, string slotsTag)
    {
        GameObject[] slots = GameObject.FindGameObjectsWithTag(slotsTag);
        foreach (GameObject slot in slots)
        {
            foreach (Coordination hit in shootImpactDto.hits)
            {
                Coordination c = slot.GetComponent <Slot>().Coordination;
                if (c.x == hit.x && c.y == hit.y)
                {
                    slot.GetComponent <Slot>().SetIsHit();
                }
            }
        }

        foreach (GameObject slot in slots)
        {
            foreach (Coordination hit in shootImpactDto.misses)
            {
                Coordination c = slot.GetComponent <Slot>().Coordination;
                if (c.x == hit.x && c.y == hit.y)
                {
                    slot.GetComponent <Slot>().SetIsMiss();
                }
            }
        }
    }
コード例 #3
0
        public override async Task <bool> OnKilledRiftGaurdian(Message sender, EventData e)
        {
            if (e.IsLeaderEvent)
            {
                Log.Warn("{0} killed a rift gaurdian", e.OwnerHeroAlias);

                if (GameUI.ReviveAtCheckpointButton.IsVisible && GameUI.ReviveAtCheckpointButton.IsEnabled)
                {
                    GameUI.ReviveAtCheckpointButton.Click();
                    await Coroutine.Sleep(3000);
                }

                var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(8);
                while (Player.IsDead && DateTime.UtcNow < timeout)
                {
                    await Coroutine.Sleep(250);

                    await Coroutine.Yield();
                }

                await Coordination.TeleportToRiftGaurdianLoot(sender);

                return(true);
            }
            return(false);
        }
コード例 #4
0
	//determine whether "I" get win
	private bool win(){
		bool won = false;
		ArrayList foundRowList;
		
		if (stepCount >= multi_init.totalLength) {
			//find start edge
			for (int i = 0; i < multi_init.totalLength; i++){
				if(visitRow[i,0] ==  true){
					foundRowList = new ArrayList ();
					Coordination cord = new Coordination(i,0);
					foundRowList.Add(cord);
					//won = findNextEdge(i,0,1,foundRowList);
					won = setPathArray(cord, foundRowList);
					if (won) {
						Camera.main.SendMessage("disableButtons");

						ArrayList path = new ArrayList ();
						//set first path
						Coordination coor = (Coordination)foundRowList[0];
						addPath (coor.getX (), coor.getY (), path);
						addPath (coor.getX (), coor.getY ()+1, path);
						Coordination c = new Coordination (coor.getX (), coor.getY ()+1);
						setPathArray (c, path);

						character.winAnimation(path);
						break;
					}
				}
			}
		}
		
		return won;
	}
コード例 #5
0
 public ActionResult Create(Coordination coordination)
 {
     if (ModelState.IsValid)
     {
         var data = db.Coordinations.Where(a => a.Is_Deleted != true && a.Year == DateTime.Now.Year && a.FacultyId == coordination.FacultyId).SingleOrDefault();
         if (data != null)
         {
             ViewBag.ErrMessage = Languages.Language.CoordinationErr;
             ViewBag.UType      = new SelectList(db.UniversityTypes.Where(a => a.Is_Deleted != true), "Id", "UniversityTypeName");
             if (Session["lang"] != null)
             {
                 if (Session["lang"].ToString().Equals("ar-EG"))
                 {
                     ViewBag.UType = new SelectList(db.UniversityTypes.Where(a => a.Is_Deleted != true), "Id", "UniversityTypeNameArabic");
                 }
             }
             return(View(coordination));
         }
         coordination.Year = DateTime.Now.Year;
         db.Coordinations.Add(coordination);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ErrMessage = Languages.Language.CoordinationErr;
     ViewBag.UType      = new SelectList(db.UniversityTypes.Where(a => a.Is_Deleted != true), "Id", "UniversityTypeName");
     if (Session["lang"] != null)
     {
         if (Session["lang"].ToString().Equals("ar-EG"))
         {
             ViewBag.UType = new SelectList(db.UniversityTypes.Where(a => a.Is_Deleted != true), "Id", "UniversityTypeNameArabic");
         }
     }
     return(View(coordination));
 }
コード例 #6
0
        public async Task <CoordinationResponse> SaveAsync(Coordination coordination)
        {
            try
            {
                (Boolean success, String error)check = await idChecks(coordination);

                if (!check.success)
                {
                    return(new CoordinationResponse(check.error));
                }
                // Sets the date and time for the attributes published and last updated to current time.
                coordination.DatePublished   = DateTime.Now;
                coordination.DateLastUpdated = DateTime.Now;

                var createCoordinationTask = Task.Run(async() => {
                    coordination = await _coordinationRepository.AddAsync(coordination);
                    await _unitOfWork.CompleteAsync();
                    await addTags(coordination);
                    return(coordination);
                });

                return(await CreateGitLabProject(createCoordinationTask, coordination));
            }
            catch (Exception ex)
            {
                return(new CoordinationResponse($"An error occured when saving the coordination: {ex.Message}"));
            }
        }
コード例 #7
0
        // Method to add tags based on the id and a bit messy because it is sent as a string.
        private async Task addTags(Coordination coordination)
        {
            try
            {
                // Tries to parse tag ids from string to int
                foreach (string idString in coordination.TagsIds.Split(','))
                {
                    if (idString == null || idString == "")
                    {
                        continue;
                    }
                    int  tagId       = Int32.Parse(idString.Trim());
                    Tags existingTag = await _tagsRepository.FindByIdAsync(tagId);

                    if (existingTag != null)
                    {
                        // If the tag exists, add it to the list of tags in the coordination
                        CoordinationTags coordinationTag = new CoordinationTags {
                            Coordination = coordination, Tags = existingTag
                        };
                        coordination.CoordinationTags.Add(coordinationTag);
                    }
                }
                await _unitOfWork.CompleteAsync();
            }
            catch (Exception ex)
            {
                await _unitOfWork.CompleteAsync();

                Console.WriteLine(ex.Message);
            }
        }
コード例 #8
0
        public async Task TestUpdate()
        {
            Res = await CS.FindByIdAsync(5);

            Assert.IsFalse(Res.Success);

            Res = await CS.UpdateAsync(5, ExampleV);

            Assert.IsFalse(Res.Success, "Success on updating on an ID that should not exist");

            Res = await CS.FindByIdAsync(100);

            Assert.IsTrue(Res.Success);
            Coordination exampleA    = Res.Resource;                   // Should use clone()
            var          exampleAImg = CoordinationSnapshot(exampleA); // CoordinationSnapshot is not a good function, and should be replaced by clone and equals in Coordination

            Res = await CS.UpdateAsync(100, ExampleV);

            Assert.IsTrue(Res.Success, "Failed to update an existing ID with a new valid state.");

            Coordination exampleB    = Res.Resource;
            var          exampleBImg = CoordinationSnapshot(exampleB);

            Assert.AreNotEqual(exampleAImg.Title, exampleB.Title, "Title before update is equal to title after update.");
            Assert.AreEqual(ExampleV.Title, exampleB.Title, "Updated title is not equal to inputted title.");
        }
コード例 #9
0
        public async Task <CoordinationResponse> UpdateAsync(int id, Coordination coordination)
        {
            var existingCoordination = await _coordinationRepository.FindByIdAsync(id);

            if (existingCoordination == null)
            {
                return(new CoordinationResponse("Coordination not found."));
            }

            try
            {
                (Boolean success, String error)check = await idChecks(coordination);

                if (!check.success)
                {
                    return(new CoordinationResponse(check.error));
                }
                // Set last updated to current time
                existingCoordination.DateLastUpdated = DateTime.Now;

                // Update attributes
                existingCoordination.Title             = coordination.Title;
                existingCoordination.Description       = coordination.Description;
                existingCoordination.PublisherId       = coordination.PublisherId;
                existingCoordination.UnderCoordination = coordination.UnderCoordination;
                existingCoordination.StatusDescription = coordination.StatusDescription;
                existingCoordination.CategoryId        = coordination.CategoryId;
                existingCoordination.TagsIds           = coordination.TagsIds;
                existingCoordination.AccessLevel       = coordination.AccessLevel;

                existingCoordination.CoordinationTags.Clear();
                await addTags(existingCoordination);

                _coordinationRepository.Update(existingCoordination);

                // Send notifications
                await _notificationService.AddUserNotificationsAsync(existingCoordination, existingCoordination, existingCoordination.Title + " - " + existingCoordination.Publisher.Name, "Samordningen '" + existingCoordination.Title + "' har blitt oppdatert.");

                await _notificationService.AddPublisherNotificationsAsync(existingCoordination, existingCoordination, existingCoordination.Title + " - " + existingCoordination.Publisher.Name, "Samordningen din '" + existingCoordination.Title + "' har blitt oppdatert.");

                await _unitOfWork.CompleteAsync();

                if (coordination.GitlabProjectId == null)
                {
                    var createCoordinationTask = Task.Run(() => {
                        return(existingCoordination);
                    });
                    await CreateGitLabProject(createCoordinationTask, existingCoordination);
                }
                await _gitlabService.UpdateProject(existingCoordination);

                return(new CoordinationResponse(existingCoordination));
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new CoordinationResponse($"An error occurred when updating the coordination: {ex.Message}"));
            }
        }
コード例 #10
0
ファイル: CoordinationService.cs プロジェクト: 842549829/Pool
        private static Coordination ConstructCoordination(Log.Domain.OrderLog log)
        {
            var matchResult = logTypereg.Match(log.Content);
            var result      = new Coordination(log.Account, matchResult.Success ? matchResult.Groups["reason"].Value : "成功出票",
                                               matchResult.Success ? "拒绝出票" : "出票成功", BusinessType.出票, ContactMode.Telphone, log.Time, OrderRole.Provider);

            return(result);
        }
コード例 #11
0
 public Airport(string name, string city, string country, string iata3, Coordination coordination)
 {
     Name         = name;
     City         = city;
     Country      = country;
     IATA3        = iata3;
     Coordination = coordination;
 }
コード例 #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            Coordination coordination = db.Coordinations.Find(id);

            coordination.Is_Deleted = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #13
0
 public override async Task <bool> OnInTrouble(Message sender, EventData e)
 {
     if (e.IsFollowerEvent && !Data.Monsters.Any(m => m.Distance <= 80f) && sender.IsInSameWorld && !RiftHelper.IsInGreaterRift)
     {
         Log.Info("My minion needs help! Teleporting to {0}. Distance={1}", sender.HeroAlias, sender.Distance);
         await Coordination.TeleportToPlayer(sender);
     }
     return(false);
 }
コード例 #14
0
	private bool visit(Coordination cord, ArrayList list){
		for (int i = 0; i < list.Count; i++) {
			Coordination temp = list[i] as Coordination;
			if(cord.Equals(temp))
				return true;
		}
		
		return false;
	}
コード例 #15
0
	//find path from top to down
	private bool findNextEdge(int edgeRow, int edgeCol, int rowReached, ArrayList foundCol){
		bool found = false;
		Coordination cord;

		int length = aiMode_init.totalLength;
		int maxCol = aiMode_init.maxCol;

		if (rowReached == length) //reached
			found = true;
		else {
			cord = new Coordination(edgeRow+1, edgeCol);
			if (edgeRow+1 <= maxCol && visitCol[edgeRow+1,edgeCol] == true && !visit(cord,foundCol)){
				foundCol.Add(cord);
				found = findNextEdge(edgeRow+1,edgeCol,rowReached+1,foundCol);
				if(!found)//delete the new element added in arraylist
					foundCol.RemoveAt(foundCol.Count-1);
			}

			//find downward left row
			if (edgeCol!=0 && !found){
				if (edgeRow+1 <= maxCol && edgeCol-1 >= 0 && visitRow[edgeRow+1,edgeCol-1] == true)
						found = findNextVerticalEdge(edgeRow+1,edgeCol-1,rowReached,foundCol);
			}

			//find upward left row
			if(!found && edgeCol !=0){
				if (edgeCol-1 >= 0 && visitRow[edgeRow,edgeCol-1] == true)
					found = findNextVerticalEdge(edgeRow, edgeCol-1, rowReached-1,foundCol);
			}

			//downward right row
			if(edgeCol != 4 && !found){
				if (edgeRow+1 <= maxCol && visitRow[edgeRow+1,edgeCol] == true)
						found = findNextVerticalEdge (edgeRow+1,edgeCol,rowReached,foundCol);
				}
			}

			//upward right
			if (!found && edgeCol != 4) {
				if (visitRow[edgeRow,edgeCol] == true)
					found = findNextVerticalEdge(edgeRow,edgeCol,rowReached-1,foundCol);
			}

			//backward col
			if (!found && edgeRow-1 >= 0){
				cord = new Coordination(edgeRow-1,edgeCol);
				if (edgeRow-1 >= 0 && visitCol[edgeRow-1,edgeCol] == true && !visit(cord,foundCol)){
					foundCol.Add(cord);
					found = findNextEdge(edgeRow-1,edgeCol,rowReached-1,foundCol);
					if(!found)
						foundCol.RemoveAt(foundCol.Count-1);
				}
			}

		return found;
	}
コード例 #16
0
        /// <summary>
        ///  Check if a point is intersected with the sorting box.
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public async Task <bool> IsIntersected(Point point)
        {
            bool isIntersect = false;
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                isIntersect = Coordination.IsIntersect(point, this, true);
            });

            return(isIntersect);
        }
コード例 #17
0
ファイル: MenuBar.cs プロジェクト: shuoniu89/CoLocatedCard
        /// <summary>
        /// Check if the point is intersect with delete button
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        internal async Task <bool> IsIntersectWithDelete(Point position)
        {
            bool isIntersect = false;
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                isIntersect = Coordination.IsIntersect(position, deleteButton, false);
            });

            return(isIntersect);
        }
コード例 #18
0
 public override async Task <bool> OnKilledRiftGaurdian(Message sender, EventData e)
 {
     if (e.IsMyEvent)
     {
         Log.Warn("I killed a rift gaurdian, all me.", e.OwnerHeroAlias);
         Coordination.WaitFor(TimeSpan.FromSeconds(5));
         Coordination.WaitFor(TimeSpan.FromSeconds(30), () => AutoFollow.CurrentParty.All(b => b.Distance < 60f));
         return(true);
     }
     return(false);
 }
コード例 #19
0
        public IActionResult Post([FromBody] User user, decimal latitude, decimal longitude)
        {
            Coordination coordination = new Coordination()
            {
                Latitude = latitude, Longitude = longitude
            };

            int userId = _businessLayer.CreateAppUser(user, coordination);

            return(Created($"{_resourceUrl}{userId}", userId));
        }
コード例 #20
0
 CoordinationSnapshot(Coordination c)
 {
     return(
         c.Id,
         c.Title,
         c.Description,
         c.PublisherId,
         c.UnderCoordination,
         c.StatusDescription,
         c.CategoryId,
         c.TagsIds
         );
 }
コード例 #21
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (GetComponent <Slot>().IsHit() || GetComponent <Slot>().IsMiss())
     {
         return;
     }
     initAll();
     firePosition = GetComponent <Slot>().Coordination;
     IsSelected   = true;
     GetComponent <Image>().color = Color.gray;
     Debug.Log(firePosition.x);
     Debug.Log(firePosition.y);
     GameObject.Find("fire-btn").GetComponent <Button>().interactable = true;
 }
コード例 #22
0
    public void ExecutShoot(Coordination coordination)
    {
        GameObject.Find("fire-btn").GetComponent <Button>().interactable = false;
        ExecShootDto execShootDto = new ExecShootDto(coordination);

        NetworkController.Send(JsonUtility.ToJson(execShootDto));
        executedShoots++;
        if (executedShoots == 3)
        {
            freeToFire     = false;
            executedShoots = 0;
            GameObject.Find("FireBoard").GetComponent <Animator>().SetTrigger("shoot-executed");
        }
    }
コード例 #23
0
        // GET: Coordinations/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Coordination coordination = db.Coordinations.Find(id);

            if (coordination == null)
            {
                return(HttpNotFound());
            }
            return(View(coordination));
        }
コード例 #24
0
        public override async Task <bool> InGameTask()
        {
            if (await base.InGameTask())
            {
                return(true);
            }

            if (await Coordination.TeleportWhenInDifferentWorld(AutoFollow.CurrentLeader))
            {
                return(true);
            }

            return(false);
        }
コード例 #25
0
        /// <summary>
        /// Method for creating new text elements
        /// </summary>
        /// <param name="parts">UDPipe service response line</param>
        /// <returns>New text element</returns>
        public IProcessable Create(string[] parts)
        {
            // Map known cases
            this.MapKnownCases(parts[2], ref parts[3]);

            IProcessable part = null;

            switch (parts[3])
            {
            case "PROPN":
            case "NOUN":
                part = this.ProcessNoun(parts);
                break;

            case "ADJ":
                part = this.ProcessAdj(parts);
                break;

            case "ADP":
                part = new Adposition(int.Parse(parts[0]), parts[2], parts[7]);
                break;

            case "NUM":
                part = new Numeral(int.Parse(parts[0]), parts[2], parts[7]);
                break;

            case "VERB":
                part = this.ProcessVerb(parts);
                break;

            case "ADV":
                part = new Adverb(int.Parse(parts[0]), parts[2], parts[7]);
                break;

            case "CONJ":
                part = new Coordination(int.Parse(parts[0]), parts[2], parts[7]);
                break;

            case "NEG":
                part = new Negation(int.Parse(parts[0]), parts[2], parts[7]);
                break;

            default:
                break;
            }

            return(part);
        }
コード例 #26
0
	//pass a horizontal edge coordination into this method
	private bool findNextEdge(int edgeRow, int edgeCol, int colReached, ArrayList foundRow){
		bool found = false;
		Coordination cord;

		if (colReached == multi_init.totalLength) //reached
			found = true;
		else {
				//check straigh next horizontal edge
				cord = new Coordination(edgeRow, edgeCol+1);
			if (edgeCol+1 <= multi_init.maxCol && visitRow[edgeRow,edgeCol+1] == true && !visit (cord,foundRow)){
					foundRow.Add(cord);
					found = findNextEdge(edgeRow,edgeCol+1,colReached+1,foundRow);
					if(!found)//delete the new element added in arraylist
						foundRow.RemoveAt(foundRow.Count-1);
				}

				//check downward vertical edge
				if (!found && edgeCol+1 <= multi_init.maxCol && edgeRow!=4 && visitCol[edgeRow,edgeCol+1] == true){
					found = findNextHorizontalEdge(edgeRow,edgeCol+1,colReached,foundRow);
				}
				
				//check backward downward
				if(!found && edgeRow!=4 && visitCol[edgeRow,edgeCol] == true){
					found = findNextHorizontalEdge(edgeRow,edgeCol,colReached-1,foundRow);
				}
				
				//check upward vertical edge
				if (!found && edgeRow !=0 && edgeCol+1 <= multi_init.maxCol && visitCol[edgeRow-1,edgeCol+1] == true){
					found = findNextHorizontalEdge(edgeRow-1,edgeCol+1,colReached,foundRow);
				}

				//check backward upward
				if(!found && edgeRow != 0 && visitCol[edgeRow-1,edgeCol] == true)
					found = findNextHorizontalEdge(edgeRow-1,edgeCol,colReached-1,foundRow);

				if (!found && edgeCol-1 >= 0){//check backward row
					cord = new Coordination(edgeRow,edgeCol-1);
					if (visitRow[edgeRow,edgeCol-1] == true && !visit(cord,foundRow)){
						foundRow.Add(cord);
						found = findNextEdge(edgeRow,edgeCol-1,colReached-1,foundRow);
						if(!found)
							foundRow.RemoveAt(foundRow.Count-1);
					}
				}
			}
		return found;
	}
コード例 #27
0
        public override async Task <bool> InGameTask()
        {
            // Returning True => go to next tick immediately, execution starts again from top of the tree.
            // Returning False => allow execution to continue to lower hooks. Such as profiles, Adventurer.

            if (!AutoFollow.CurrentLeader.IsValid)
            {
                return(false);
            }

            //if (!Service.IsConnected || AutoFollow.NumberOfConnectedBots == 0)
            //    return false;

            if (Player.IsInTown && AdvDia.CurrentWorldId != ExplorationData.ActHubWorldIds[Act.A1])
            {
                return(!await WaypointCoroutine.UseWaypoint(WaypointFactory.ActHubs[Act.A1]));
            }

            if (Player.IsFollower)
            {
                if (await Party.LeaveWhenInWrongGame())
                {
                    return(true);
                }
            }

            if (await Coordination.WaitForGameStartDelay())
            {
                return(true);
            }

            if (await Coordination.WaitBeforeStartingRift())
            {
                return(true);
            }

            if (await Coordination.WaitAfterChangingWorlds())
            {
                return(true);
            }

            if (await WaitForGemUpgraded())
            {
                return(true);
            }
            return(false);
        }
コード例 #28
0
ファイル: Leader.cs プロジェクト: roifok/AutoFollow
        public override async Task <bool> InGameTask()
        {
            // Returning True => go to next tick immediately, execution starts again from top of the tree.
            // Returning False => allow execution to continue to lower hooks. Such as profiles, Adventurer.

            if (!AutoFollow.CurrentLeader.IsValid)
            {
                return(false);
            }

            if (!Service.IsConnected || AutoFollow.NumberOfConnectedBots == 0)
            {
                return(false);
            }

            if (await Coordination.WaitForGameStartDelay())
            {
                return(true);
            }

            if (await Coordination.WaitBeforeStartingRift())
            {
                return(true);
            }

            if (await Coordination.WaitAfterChangingWorlds())
            {
                return(true);
            }

            if (Player.IsFollower)
            {
                if (await Party.LeaveWhenInWrongGame())
                {
                    return(true);
                }
            }

            if (await WaitForGemUpgraded())
            {
                return(true);
            }

            return(false);
        }
コード例 #29
0
ファイル: doudou.cs プロジェクト: JudyPhy/LULU_3Country
    //计算落点坐标

    private bool CalDropPosSuccess(Sphere beHitSphere)
    {
        //Debug.LogError("===========>>>hit ball:" + index_x_behit + "   " + index_y_behit);
        Coordination dropPos = GetDropPodCoordination(beHitSphere);

        if (QuerySphere(dropPos.X, dropPos.Y) != null)
        {
            Debug.LogError("位置:" + dropPos.X + "   " + dropPos.Y + "已被占据,错误!!!!!!!");
            return(false);
        }
        else
        {
            Debug.LogError("落点是:" + dropPos.X + "   " + dropPos.Y);
            this.Index_Drop_X = dropPos.X;
            this.Index_Drop_Y = dropPos.Y;
            return(true);
        }
    }
コード例 #30
0
	private bool win(){
		Debug.Log ("<color=green>check win</color>");
		bool won = false;
		ArrayList foundRowList;
		int length = 0;
		if (SceneManager.GetActiveScene ().name == "scene_multi")
			length = multi_init.totalLength;
		else if (SceneManager.GetActiveScene ().name == "scene_ai")
			length = aiMode_init.totalLength;
		
		if (stepCount >= length) {
			//find start edge
			for (int i = 0; i < length; i++){
				if(visitCol[0,i] ==  true){
					foundRowList = new ArrayList ();
					Coordination cord = new Coordination(0,i);
					foundRowList.Add(cord);
					//won = findNextEdge(0,i,1,foundRowList);
					won = setPathArray(cord, foundRowList, length, length, false);
					if (won) {
						//StartCoroutine(winAnimation (foundRowList));
						//ch.SetActive(true);
						Camera.main.SendMessage("disableButtons");

						ArrayList path = new ArrayList ();

						//set first path
						Coordination coor = (Coordination)foundRowList[0];
						addPath (coor.getX (), coor.getY (), path);
						addPath (coor.getX ()+1, coor.getY (), path);
						Coordination c = new Coordination (coor.getX () + 1, coor.getY ());
						setPathArray (c, path, length, length, false);
						if(aiMode_init.mustConnect)
							checkConnectBonusNode (path);
						character.winAnimation(path);

						break;
					}
				}
			}
		}
		Debug.Log ("<color=green>" + won + "</color>");
		return won;
	}
コード例 #31
0
ファイル: Config.cs プロジェクト: hughperkins/osmp-cs
        public void RefreshConfig()
        {
            Test.Debug( "reading config.xml ..." );
            configdoc = XmlHelper.OpenDom( EnvironmentHelper.GetExeDirectory() + "/" + sFilePath );

            XmlElement systemnode = (XmlElement)configdoc.DocumentElement.SelectSingleNode( "config");
            iDebugLevel = Convert.ToInt32( systemnode.GetAttribute("debuglevel") );
            Test.Debug("DebugLevel " + iDebugLevel.ToString() );

            clientconfig = (XmlElement)configdoc.DocumentElement.SelectSingleNode( "client");

            coordination = new Coordination( (XmlElement)configdoc.DocumentElement.SelectSingleNode( "coordination") );

            XmlElement displaynode = clientconfig.SelectSingleNode("display") as XmlElement;
            windowwidth = GetInt(displaynode, "width");
            windowheight = GetInt(displaynode, "height");

            XmlElement worldnode = clientconfig.SelectSingleNode( "world" ) as XmlElement;
            world_xsize = GetInt( worldnode, "x_size" );
            world_ysize = GetInt( worldnode, "y_size" );
            mingroundheight = GetDouble( worldnode, "mingroundheight" );
            maxgroundheight = GetDouble( worldnode, "maxgroundheight" );
            ceiling = GetDouble( worldnode, "ceiling" );

            XmlElement heighteditingnode = clientconfig.SelectSingleNode( "heightediting" ) as XmlElement;
            HeightEditingSpeed = GetDouble( heighteditingnode, "speed" );
            brushsize = GetInt( heighteditingnode, "defaultbrushsize" );

            XmlElement servernode = (XmlElement)configdoc.DocumentElement.SelectSingleNode("server");
            ServerPort = Convert.ToInt32( servernode.GetAttribute("port"));
            ServerIPAddress = servernode.GetAttribute("ipaddress");

            foreach (XmlElement mappingnode in clientconfig.SelectNodes("keymappings/key"))
            {
                string sCommand = mappingnode.GetAttribute("command");
                string sKeyCodes = mappingnode.GetAttribute("keycode");
                string[] KeyCodes = sKeyCodes.Split("-".ToCharArray());
                List<string> keycodelist = new List<string>(KeyCodes);
                CommandCombos.Add(new CommandCombo(sCommand, keycodelist));
            }
            foreach (XmlElement mousemovenode in clientconfig.SelectNodes("mousemoveconfigs/mousemove"))
            {
                string name = mousemovenode.GetAttribute("name");
                string vertical = mousemovenode.GetAttribute("vertical");
                string horizontal = mousemovenode.GetAttribute("horizontal");
                string zoom = mousemovenode.GetAttribute("zoom");
                bool invertvertical = false;
                bool invertscroll = false;
                if (mousemovenode.HasAttribute("invertvertical") && mousemovenode.GetAttribute("invertvertical") == "yes")
                {
                    invertvertical = true;
                }
                if (mousemovenode.HasAttribute("invertscroll") && mousemovenode.GetAttribute("invertscroll") == "yes")
                {
                    invertscroll = true;
                }
                if (!MouseMoveConfigsByName.ContainsKey(name))
                {
                    MouseMoveConfigsByName.Add(name, new MouseMoveConfig(vertical, horizontal, zoom, invertvertical, invertscroll));
                }
            }

            Test.Debug("... config.xml read");
        }