Пример #1
0
 internal static void CheckAndAddResource(FlextourEntities context, List <RESOURCE> resources, MEDIAINFO section, string imagePath,
                                          string description, string resolution)
 {
     if (!string.IsNullOrEmpty(imagePath))
     {
         bool resourceExists = false;
         if (section.ID != 0)
         {
             string id = section.ID.ToString();
             resourceExists = context.RESOURCE.Any(r => r.LINK_TABLE == "MEDIAITEM" && r.RECTYPE == "IMAGE" &&
                                                   r.ITEM == imagePath && r.LINK_VALUE == id);
         }
         if (!resourceExists)
         {
             RESOURCE resource = new RESOURCE();
             resource.LINK_TABLE = "MEDIAITEM";
             resource.RECTYPE    = "IMAGE";
             resource.TAG        = resolution; //resolution
             resource.ITEM       = imagePath;
             if (description.Length <= 50)
             {
                 resource.DESCRIPTION = description;
             }
             else
             {
                 resource.DESCRIPTION = description.Substring(0, 50);
             }
             resources.Add(resource);
         }
     }
 }
Пример #2
0
            public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
            {
                BufferAccessor <AbilityBuffer> abilityBufffers   = chunk.GetBufferAccessor(AbilityBufferChunk);
                BufferAccessor <COST_BUFFER>   costBuffers       = chunk.GetBufferAccessor(CostBufferChunk);
                NativeArray <RESOURCE>         resourceComponent = chunk.GetNativeArray(ResourceComponent);

                for (int entityIndex = 0; entityIndex < chunk.Count; ++entityIndex)
                {
                    NativeArray <AbilityBuffer> AbilityBufferArray = abilityBufffers[entityIndex].AsNativeArray();
                    NativeArray <COST_BUFFER>   costBufferArray    = costBuffers[entityIndex].AsNativeArray();
                    for (int abilityIndex = 0; abilityIndex < AbilityBufferArray.Length; ++abilityIndex)
                    {
                        Ability Ability = AbilityBufferArray[abilityIndex];


                        if (Ability.State != AbilityState.Active)
                        {
                            continue;
                        }
                        for (int costIndex = 0; costIndex < costBufferArray.Length; costIndex++)
                        {
                            COST_BUFFER costBuffer = costBufferArray[costIndex];
                            if (costBuffer.AbilityIndex != abilityIndex)
                            {
                                continue;
                            }
                            RESOURCE resource = resourceComponent[entityIndex];
                            CostConsumer.ConsumeCost(costBuffer.Cost, ref resource);
                            resourceComponent[entityIndex] = resource;
                        }
                    }
                }
            }
Пример #3
0
            public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
            {
                BufferAccessor <AbilityBuffer> abilityBufffers = chunk.GetBufferAccessor(AbilityBufferChunk);
                BufferAccessor <COST_BUFFER>   costBuffers     = chunk.GetBufferAccessor(CostBufferChunk);
                NativeArray <RESOURCE>         resources       = chunk.GetNativeArray(ResourceChunk);

                for (int entityIndex = 0; entityIndex < chunk.Count; ++entityIndex)
                {
                    NativeArray <AbilityBuffer> AbilityBufferArray = abilityBufffers[entityIndex].AsNativeArray();
                    NativeArray <COST_BUFFER>   costBufferArray    = costBuffers[entityIndex].AsNativeArray();
                    RESOURCE resource = resources[entityIndex];
                    for (int abilityIndex = 0; abilityIndex < AbilityBufferArray.Length; ++abilityIndex)
                    {
                        Ability Ability = AbilityBufferArray[abilityIndex];
                        bool    temp    = true;
                        for (int costIndex = 0; costIndex < costBufferArray.Length; ++costIndex)
                        {
                            COST_BUFFER CostBuffer = costBufferArray[costIndex];
                            if (CostBuffer.AbilityIndex != abilityIndex)
                            {
                                continue;
                            }
                            temp &= CostChecker.HasEnougthResourceLeft(CostBuffer.Cost, in resource);
                        }
                        Ability.HasEnougthRessource     &= temp;
                        AbilityBufferArray[abilityIndex] = Ability;
                    }
                }
            }
Пример #4
0
 public ResourceStatus(RESOURCE resource, RESOURCE_STATUS status, int amount, int daysToReachGoal)
 {
     this.resource        = resource;
     this.status          = status;
     this.amount          = amount;
     this.daysToReachGoal = daysToReachGoal;
 }
Пример #5
0
    void DetermineCityUpgradeResourceType()
    {
        switch (this.kingdomRace)
        {
        case RACE.HUMANS:
            this.primaryRaceResource   = RESOURCE.STONE;
            this.secondaryRaceResource = RESOURCE.METAL;
            break;

        case RACE.ELVES:
            this.primaryRaceResource   = RESOURCE.LUMBER;
            this.secondaryRaceResource = RESOURCE.MANA;
            break;

        case RACE.MINGONS:
            this.primaryRaceResource   = RESOURCE.LUMBER;
            this.secondaryRaceResource = RESOURCE.METAL;
            break;

        case RACE.CROMADS:
            this.primaryRaceResource   = RESOURCE.STONE;
            this.secondaryRaceResource = RESOURCE.MANA;
            break;
        }
    }
Пример #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            RESOURCE rESOURCE = db.RESOURCES.Find(id);

            db.RESOURCES.Remove(rESOURCE);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #7
0
        /// <summary>
        /// Ons the resource complete.
        /// </summary>
        /// <param name="res">The resource.</param>
        private void onResComplete(IAsyncResult res)
        {
            IEnumerable <RESOURCE> resources = resourceDsq.EndExecute(res);
            RESOURCE resource = resources.FirstOrDefault();

            resTypeDsq = (DataServiceQuery <RES_TYPE>)(ctx.RES_TYPE.Where(r => r.ID == resource.TYPE));
            resTypeDsq.BeginExecute(onQueryComplete2, null);
        }
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            RESOURCE rESOURCE = await db.RESOURCES.FindAsync(id);

            db.RESOURCES.Remove(rESOURCE);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Пример #9
0
    void ProcessTransaction(RESOURCE resourceType, int quantity, int totalCost)
    {
        this.targetCity.AdjustResourceCount(resourceType, quantity);
        this.targetCity.AdjustResourceCount(RESOURCE.GOLD, (totalCost * -1));

        this.AdjustItems(resourceType, (quantity * -1));

        this.citizen.city.AdjustResourceCount(RESOURCE.GOLD, totalCost);
    }
Пример #10
0
 public ActionResult Edit([Bind(Include = "ResourcesID,Resourcesname,Quantity,Total")] RESOURCE rESOURCE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rESOURCE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rESOURCE));
 }
Пример #11
0
 /// <summary>
 /// Add a new resource
 /// </summary>
 /// <param name="resource">The resource to add</param>
 /// <returns>True if resource is added successfuly otherwise false</returns>
 public bool AddResource(RESOURCE resource)
 {
     if (resource != null)
     {
         db.RESOURCEs.Add(resource);
         db.SaveChanges();
         return(true);
     }
     return(false);
 }
Пример #12
0
        public ActionResult Create([Bind(Include = "ResourcesID,Resourcesname,Quantity,Total")] RESOURCE rESOURCE)
        {
            if (ModelState.IsValid)
            {
                db.RESOURCES.Add(rESOURCE);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rESOURCE));
        }
Пример #13
0
        public async Task <ActionResult> Edit([Bind(Include = "RESOURCE_ID,RESOURCE_NAME,ORDER_DATE,AMOUNT")] RESOURCE rESOURCE)
        {
            if (ModelState.IsValid)
            {
                db.Entry(rESOURCE).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(rESOURCE));
        }
Пример #14
0
        public async Task <ActionResult> Create([Bind(Include = "RESOURCE_ID,RESOURCE_NAME,ORDER_DATE,AMOUNT")] RESOURCE rESOURCE)
        {
            if (ModelState.IsValid)
            {
                db.RESOURCES.Add(rESOURCE);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(rESOURCE));
        }
Пример #15
0
 override public int GetAveDailyProduction(RESOURCE resourceType)
 {
     if (this.citizen == null)
     {
         return(0);
     }
     if (resourceType == RESOURCE.MANA)
     {
         int halfHexValue = (int)((float)this.citizen.assignedTile.manaValue / 2f);
         return((int)((halfHexValue + (this.citizen.level * (halfHexValue / 2f))) * this.citizen.city.alchemistMultiplier));
     }
     return(0);
 }
Пример #16
0
 override public int GetDailyProduction(RESOURCE resourceType)
 {
     if (this.citizen == null)
     {
         return(0);
     }
     if (resourceType == RESOURCE.STONE)
     {
         int halfHexValue = (int)((float)this.citizen.assignedTile.stoneValue / 2f);
         return((int)((halfHexValue + (this.citizen.level * (halfHexValue / 2f))) * this.citizen.city.quarrymanMultiplier));
     }
     return(0);
 }
Пример #17
0
 override public int GetDailyProduction(RESOURCE resourceType)
 {
     if (this.citizen == null)
     {
         return(0);
     }
     if (resourceType == RESOURCE.FOOD)
     {
         int halfHexValue = (int)((float)this.citizen.assignedTile.farmingValue / 2f);
         return((int)((halfHexValue + (this.citizen.level * UnityEngine.Random.Range(1, halfHexValue + 1))) * this.citizen.city.farmerMultiplier));
     }
     return(0);
 }
Пример #18
0
        // GET: Admin/RESOURCES/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RESOURCE rESOURCE = db.RESOURCES.Find(id);

            if (rESOURCE == null)
            {
                return(HttpNotFound());
            }
            return(View(rESOURCE));
        }
Пример #19
0
        // GET: RESOURCEs/Delete/5
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RESOURCE rESOURCE = await db.RESOURCES.FindAsync(id);

            if (rESOURCE == null)
            {
                return(HttpNotFound());
            }
            return(View(rESOURCE));
        }
Пример #20
0
    // ステージを作成する関数
    void CreateStage()
    {
        // マスPrefab
        GameObject massPrefab = Resources.Load <GameObject>("Mass");

        // ステージを初期化
        for (int y = 0; y < stageLength.Length; y++)
        {
            List <MassData> massDatas = new List <MassData>();
            for (int x = 0; x < stageLength[y]; x++)
            {
                // マスを作成
                var massObj = Instantiate(massPrefab);
                // 位置を決定
                Vector3 pos    = Vector3.zero;
                var     offset = stageLength[0] % 2 == 0 ? -1 : 1;
                // ハニカム構造に並べる
                pos.x = ((x - (stageLength[y] / 2)) * 2.0f) + (y % 2 == 0?0:offset);
                pos.z = ((stageLength.Length / 2) - y) * 1.75f;
                massObj.transform.position = pos;
                // このマスのデータを決める
                MassData mass = new MassData();
                // マスの資源を決める
                while (true)
                {
                    // 乱数で資源を決める
                    RESOURCE resource = (RESOURCE)Random.Range(0, System.Enum.GetValues(typeof(RESOURCE)).Length);
                    // これ以上その資源を置けるかチェック
                    if ((useResourecs[resource] + 1) > resourcesMax[resource])
                    {
                        continue;
                    }
                    useResourecs[resource]++;
                    mass.resource = resource;
                    break;
                }
                // 資源に合わせてマテリアルを変更
                massObj.GetComponentInChildren <MeshRenderer>().material = resourceMaterials[(int)mass.resource];
                // マスに番号をセット
                SetMassNumber();

                massDatas.Add(mass);
            }
            stages.Add(massDatas);
        }
    }
Пример #21
0
    void AdjustItems(RESOURCE resourceType, int earnings)
    {
        bool adjustedSuccessfully = false;

        for (int i = 0; i < this.tradeGoods.Count; i++)
        {
            if (this.tradeGoods [i].resourceType == resourceType)
            {
                this.tradeGoods [i].resourceQuantity += earnings;
                adjustedSuccessfully = true;
                break;
            }
        }
        if (!adjustedSuccessfully)
        {
            this.tradeGoods.Add(new Resource(resourceType, earnings));
        }
    }
Пример #22
0
    int GetCostPerResourceUnit(RESOURCE resourceType)
    {
        switch (resourceType)
        {
        case RESOURCE.FOOD:
            return(5);

        case RESOURCE.LUMBER:
            return(10);

        case RESOURCE.STONE:
            return(10);

        case RESOURCE.MANA:
            return(10);

        case RESOURCE.METAL:
            return(10);
        }
        return(0);
    }
Пример #23
0
        /// <summary>
        /// parse a <code>&lt;process-archive .../&gt;</code> element and add it to the list of parsed elements
        /// </summary>
        protected internal virtual void parseProcessArchive(Element element, IList <ProcessArchiveXml> parsedProcessArchives)
        {
            ProcessArchiveXmlImpl processArchive = new ProcessArchiveXmlImpl();

            processArchive.Name     = element.attribute(NAME);
            processArchive.TenantId = element.attribute(TENANT_ID);

            IList <string> processResourceNames = new List <string>();

            IDictionary <string, string> properties = new Dictionary <string, string>();

            foreach (Element childElement in element.elements())
            {
                if (PROCESS_ENGINE.Equals(childElement.TagName))
                {
                    processArchive.ProcessEngineName = childElement.Text;
                }
                else if (PROCESS.Equals(childElement.TagName) || RESOURCE.Equals(childElement.TagName))
                {
                    processResourceNames.Add(childElement.Text);
                }
                else if (PROPERTIES.Equals(childElement.TagName))
                {
                    parseProperties(childElement, properties);
                }
            }

            // set properties
            processArchive.Properties = properties;

            // add collected resource names.
            processArchive.ProcessResourceNames = processResourceNames;

            // add process archive to list of parsed archives.
            parsedProcessArchives.Add(processArchive);
        }
Пример #24
0
 public virtual int GetAveDailyProduction(RESOURCE resourceType)
 {
     return(0);
 }
Пример #25
0
 public static RESOURCE CreateRESOURCE(int ID, int lESSON_ID, string tITLE, int tYPE, string uRL)
 {
     RESOURCE rESOURCE = new RESOURCE();
     rESOURCE.ID = ID;
     rESOURCE.LESSON_ID = lESSON_ID;
     rESOURCE.TITLE = tITLE;
     rESOURCE.TYPE = tYPE;
     rESOURCE.URL = uRL;
     return rESOURCE;
 }
Пример #26
0
 public void AddToRESOURCE(RESOURCE rESOURCE)
 {
     base.AddObject("RESOURCE", rESOURCE);
 }
Пример #27
0
 public Resource(RESOURCE resourceType, int resourceQuantity)
 {
     this.resourceType     = resourceType;
     this.resourceQuantity = resourceQuantity;
 }
Пример #28
0
 public SPoolingObject(RESOURCE pResource)
 {
     bEnable = false; this.pResource = pResource;
 }
Пример #29
0
 public static extern int WNetOpenEnum(RESOURCE dwScope, RESOURCETYPE dwType, RESOURCEUSAGE dwUsage, IntPtr lpNetResource, out SafeNetEnumHandle lphEnum);
Пример #30
0
 public int GetAveDailyProduction(RESOURCE resourceType)
 {
     return(_job.GetAveDailyProduction(resourceType));
 }
Пример #31
0
        /// <summary>
        /// Invoked when all uplaod button is clicked.
        /// </summary>
        /// <param name="sender">The all upload button clicked.</param>
        /// <param name="e">Event data that describes how the click was initiated.</param>
        /// <exception cref="InvalidDataException">
        /// </exception>
        private async void allUploadButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckCourseInfomation())
            {
                ShowMessageDialog("Format error4! Please check your upload infomation.");
                return;
            }

            addLessonButton.IsEnabled    = false;
            allUploadButton.IsEnabled    = false;
            resetUploadButton.IsEnabled  = false;
            uploadProgressBar.Visibility = Visibility.Visible;

            try
            {
                resourceDic = new Dictionary <string, int>(Constants.ResourceType.Count);
                for (int i = 0; i < Constants.ResourceType.Count; ++i)
                {
                    DataServiceQuery <RES_TYPE> dps = (DataServiceQuery <RES_TYPE>)(from res_type in ctx.RES_TYPE
                                                                                    where res_type.DESCRIPTION.Trim() == Constants.ResourceType[i]
                                                                                    select res_type);
                    TaskFactory <IEnumerable <RES_TYPE> > tf = new TaskFactory <IEnumerable <RES_TYPE> >();
                    RES_TYPE resID = (await tf.FromAsync(dps.BeginExecute(null, null), iar => dps.EndExecute(iar))).FirstOrDefault();

                    resourceDic.Add(Constants.ResourceType[i], resID.ID);
                }
            }
            catch
            {
                ShowMessageDialog("Network connection error5!");
                return;
            }

            string courseUplaodUri = "/CreateCourse?teacher_id=" + Constants.User.ID
                                     + "&title='" + courseNameTextBox.Text
                                     + "'&intro='" + CourseDescriptionTextBox.Text
                                     + "'&category_id=" + (categoryComboBox.SelectionBoxItem as CATEGORY).ID
                                     + "&price=" + Convert.ToDecimal(priceTextBox.Text)
                                     + "&pg_id=" + (pgComboBox.SelectionBoxItem as PARENT_GUIDE).ID
                                     + "&icon_url='" + toBeUploadCourse.ImageUri + "'";

            int newCourseID = 0;

            try
            {
                TaskFactory <IEnumerable <decimal> > tf = new TaskFactory <IEnumerable <decimal> >();
                IEnumerable <decimal> courses           = await tf.FromAsync(ctx.BeginExecute <decimal>(new Uri(courseUplaodUri, UriKind.Relative), null, null), iar => ctx.EndExecute <decimal>(iar));

                newCourseID = Convert.ToInt32(courses.FirstOrDefault());
                if (newCourseID == 0)
                {
                    throw new InvalidDataException();
                }
            }
            catch
            {
                ShowMessageDialog("Course upload error6! Please check your network.");
                return;
            }

            for (int i = 0; i < allLessons.Count; ++i)
            {
                Lesson newLesson       = allLessons[i];
                string lessonUploadUri = "/CreateLesson?course_id=" + newCourseID
                                         + "&content='" + newLesson.Content
                                         + "'&title='" + newLesson.Title +
                                         "'&number=" + newLesson.Number;
                int newLessonID = 0;
                try
                {
                    TaskFactory <IEnumerable <decimal> > tf = new TaskFactory <IEnumerable <decimal> >();
                    IEnumerable <decimal> lessons           = await tf.FromAsync(ctx.BeginExecute <decimal>(new Uri(lessonUploadUri, UriKind.Relative), null, null), iar => ctx.EndExecute <decimal>(iar));

                    newLessonID = Convert.ToInt32(lessons.FirstOrDefault());
                    if (newLessonID == 0)
                    {
                        throw new InvalidDataException();
                    }
                }
                catch
                {
                    ShowMessageDialog("Lesson error7! Please check your network.");
                    return;
                }

                try
                {
                    List <Resource> docsRes   = allLessons[i].GetDocList();
                    List <Resource> audiosRes = allLessons[i].GetAudioList();
                    List <Resource> videosRes = allLessons[i].GetVideoList();
                    for (int j = 0; j < docsRes.Count; ++j)
                    {
                        Resource r      = docsRes[j];
                        RESOURCE newRes = new RESOURCE();
                        newRes.LESSON_ID = newLessonID;
                        newRes.TYPE      = resourceDic["DOCUMENT"];
                        newRes.URL       = r.Uri;
                        newRes.TITLE     = r.Title;

                        ctx.AddToRESOURCE(newRes);
                    }
                    for (int j = 0; j < audiosRes.Count; ++j)
                    {
                        Resource r      = audiosRes[j];
                        RESOURCE newRes = new RESOURCE();
                        newRes.LESSON_ID = newLessonID;
                        newRes.TYPE      = resourceDic["AUDIO"];
                        newRes.URL       = r.Uri;
                        newRes.TITLE     = r.Title;

                        ctx.AddToRESOURCE(newRes);
                    }
                    for (int j = 0; j < videosRes.Count; ++j)
                    {
                        Resource r      = videosRes[j];
                        RESOURCE newRes = new RESOURCE();
                        newRes.LESSON_ID = newLessonID;
                        newRes.TYPE      = resourceDic["VIDEO"];
                        newRes.URL       = r.Uri;
                        newRes.TITLE     = r.Title;

                        ctx.AddToRESOURCE(newRes);
                    }
                    TaskFactory <DataServiceResponse> tfRes = new TaskFactory <DataServiceResponse>();
                    DataServiceResponse dsr = await tfRes.FromAsync(ctx.BeginSaveChanges(null, null), iar => ctx.EndSaveChanges(iar));
                }
                catch
                {
                    ShowMessageDialog("Uplaod error8! Please check your network");
                    return;
                }
            }
            addLessonButton.IsEnabled    = true;
            allUploadButton.IsEnabled    = true;
            resetUploadButton.IsEnabled  = true;
            uploadProgressBar.Visibility = Visibility.Collapsed;

            var finishMsg = new MessageDialog("Upload Finish! Please wait the check.", "Congratulation");

            finishMsg.Commands.Add(new UICommand("Continue upload", (command) =>
            {
                ResetPage();
            }));
            finishMsg.Commands.Add(new UICommand("Back", (command) =>
            {
                Frame.Navigate(typeof(CourseStore.Courstore));
            }));
            await finishMsg.ShowAsync();
        }
Пример #32
0
    void ChooseTargetCity()
    {
        List <CityTest> elligibleCitiesForTrade = new List <CityTest>();

        for (int i = 0; i < this.currentTile.GetCityTileTest().cityAttributes.connectedCities.Count; i++)
        {
            if (this.currentTile.GetCityTileTest().cityAttributes.connectedCities[i].cityAttributes.id == this.citizen.city.id ||
                !this.currentTile.GetCityTileTest().cityAttributes.connectedCities[i].cityAttributes.hexTile.isOccupied)
            {
                //Skip cities already in trade with or own city or unoccupiedCities
                continue;
            }
            CityTest currentConnectedCity = this.currentTile.GetCityTileTest().cityAttributes.connectedCities[i].cityAttributes;
            for (int j = 0; j < this.tradeGoods.Count; j++)
            {
                RESOURCE currentTradeGood = this.tradeGoods[j].resourceType;
                if (currentConnectedCity.GetResourceStatusByType(currentTradeGood).status == RESOURCE_STATUS.SCARCE)
                {
                    if (!elligibleCitiesForTrade.Contains(currentConnectedCity))
                    {
                        elligibleCitiesForTrade.Add(currentConnectedCity);
                    }
                }
            }
        }

//		if (elligibleCitiesForTrade.Count > 0) {
//			this.targetCity = elligibleCitiesForTrade [UnityEngine.Random.Range(0, elligibleCitiesForTrade.Count)];
//			this.pathToTargetCity = GameManager.Instance.GetPath(this.citizen.city.hexTile.tile, this.targetCity.hexTile.tile, PATHFINDING_MODE.NORMAL).ToList();
//			this.pathToTargetCity.Reverse();
//
//			this.citizenAvatar = GameObject.Instantiate(Resources.Load ("CitizenAvatar", typeof(GameObject)), this.citizen.city.hexTile.transform) as GameObject;
//			this.citizenAvatar.transform.localPosition = Vector3.zero;
        if (elligibleCitiesForTrade.Count <= 0)
        {
            for (int i = 0; i < this.currentTile.GetCityTileTest().cityAttributes.connectedCities.Count; i++)
            {
                if (!this.currentTile.GetCityTileTest().cityAttributes.connectedCities[i].cityAttributes.hexTile.isOccupied)
                {
                    continue;
                }
                elligibleCitiesForTrade.Add(this.currentTile.GetCityTileTest().cityAttributes.connectedCities[i].cityAttributes);
            }
        }

        elligibleCitiesForTrade.OrderByDescending(x => x.GetScarcityValue());

        if (elligibleCitiesForTrade [0].id == this.citizen.city.id)
        {
            elligibleCitiesForTrade.RemoveAt(0);
            List <CityTileTest> connectedCities = elligibleCitiesForTrade [0].connectedCities;
            for (int i = 0; i < connectedCities.Count; i++)
            {
                if (!this.currentTile.GetCityTileTest().cityAttributes.connectedCities [i].cityAttributes.hexTile.isOccupied)
                {
                    continue;
                }
                elligibleCitiesForTrade.Add(connectedCities[i].cityAttributes);
            }
        }

        this.targetCity                 = elligibleCitiesForTrade[0];
        this.pathToTargetCity           = GameManager.Instance.GetPath(this.currentTile.tile, this.targetCity.hexTile.tile, PATHFINDING_MODE.NORMAL).Reverse().ToList();
        this.citizen.city.cityLogs     += GameManager.Instance.currentDay.ToString() + ": Merchant will go to [FF0000]" + this.targetCity.cityName + "[-]. The Merchant been to " + this.numOfCitiesVisited.ToString() + " cities\n\n";
        GameManager.Instance.turnEnded += GoToDestination;
    }
Пример #33
0
 public Card(RESOURCE resource, int value)
 {
     Resource = resource;
     Value    = value;
 }