Inheritance: MonoBehaviour, IPointerClickHandler
	/// <summary>
	/// Configure modifications then call base implementation. 
	/// </summary>
	/// <param name='selection'>
	/// The selection to which the action should be applied.
	/// </param>
	public override void DoIt(object selection)
	{
		ResourceTileSelection sel = (ResourceTileSelection)selection;
		// initialize as a clearcut
		Harvest harvest = new Harvest(
			sel.ToArray(), m_duration
		);
		switch (m_cutType) {
		case CutType.DiameterLimitCut:
			harvest = new Harvest(
				sel.ToArray(), m_duration,
				m_diameterLimit, m_diameterLimitDirection
			);
			break;
		case CutType.QRatioCut:
			harvest = new Harvest(
				sel.ToArray(), m_duration,
				m_qRatio, m_basalArea
			);
			break;
		}
		StartCoroutine(harvest.ComputeCenterPoint()); // TODO: this is not pretty, but in the end this will be determined on the server anyway
		m_harvests.Add(harvest);
		m_tileModifications.resource_tile = new ModifiedFields(true);
		base.DoIt(selection);
	}
 /// Action generator
 /// @todo Implement lookup table or a design pattern for easier/automatic function generation
 public void actionGenerator( List<GameObject[]> combinations )
 {
     iThinkAction action;
     //printEverything(combinations);
     foreach ( GameObject[] matrix in combinations )
     {
       			switch ( schemaElements[0] )
         {
             case "get" :
                 action = new Get( "Get", matrix[0], matrix[1] );
                 tempActionList.Add(action);
                 break;
             case "buy" :
                 action = new Buy( "Buy", matrix[0], matrix[1], matrix[2] );
                 tempActionList.Add(action);
                 break;
             case "store" :
                 action = new Store( "Store", matrix[0], matrix[1]);
                 tempActionList.Add(action);
                 break;
             case "hunt" :
                 action = new Hunt( "Hunt", matrix[0], matrix[1], matrix[2], matrix[3]);
                 tempActionList.Add(action);
                 break;
             case "make" :
                 action = new Make( "Make", matrix[0], matrix[1], matrix[2]);
                 tempActionList.Add(action);
                 break;
             case "harvest" :
                 action = new Harvest( "Harvest", matrix[0], matrix[1], matrix[2]);
                 tempActionList.Add(action);
                 break;
             case "produce" :
                 action = new Produce( "Produce", matrix[0], matrix[1], matrix[2]);
                 tempActionList.Add(action);
                 break;
             case "craftSpell" :
                 action = new CraftSpell ("CraftSpell", matrix[0], matrix[1], matrix[2]);
                 tempActionList.Add(action);
                 break;
             case "craftSimpleWeapon" :
                 action = new CraftSimpleWeapon("CraftSimpleWeapon", matrix[0], matrix[1], matrix[2]);
                 tempActionList.Add(action);
                 break;
         }
     }
 }
        // GET Harvest get_HarvestDB
        public List <Harvest> get_HarvestDB()
        {
            List <Harvest> harvest_list = new List <Harvest>();
            SqlConnection  con          = null;

            try
            {
                con = connect("DBConnectionString");

                String     query = "SELECT * FROM [Harvest_2020]";
                SqlCommand cmd   = new SqlCommand(query, con);
                cmd.CommandTimeout = 480;                                              // enlarge T.O

                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); // the connection will close as reading completes

                while (dr.Read())
                {
                    Harvest harvest = new Harvest();

                    harvest.Batchid        = Convert.ToInt32(dr["batch_id"]);
                    harvest.Date           = Convert.ToDateTime(dr["date"]);
                    harvest.Name           = (string)dr["name"];
                    harvest.Temperature    = (float)dr["temperature"];
                    harvest.Time_tap_2     = Convert.ToDateTime(dr["timeForTapTwo"]);
                    harvest.Total_Duration = Convert.ToDateTime(dr["total_time"]);
                    harvest.Row_num        = Convert.ToInt32(dr["index"]);

                    harvest_list.Add(harvest);
                }

                return(harvest_list);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
Example #4
0
        public void Execute(Dictionary <string, string> arguments)
        {
            Console.WriteLine("[*] Action: TGT Monitoring");

            string targetUser       = null;
            int    interval         = 60;
            string registryBasePath = null;
            bool   nowrap           = false;

            if (arguments.ContainsKey("/nowrap"))
            {
                nowrap = true;
            }
            if (arguments.ContainsKey("/filteruser"))
            {
                targetUser = arguments["/filteruser"];
            }
            if (arguments.ContainsKey("/targetuser"))
            {
                targetUser = arguments["/targetuser"];
            }
            if (arguments.ContainsKey("/monitorinterval"))
            {
                interval = Int32.Parse(arguments["/monitorinterval"]);
            }
            if (arguments.ContainsKey("/interval"))
            {
                interval = Int32.Parse(arguments["/interval"]);
            }
            if (arguments.ContainsKey("/registry"))
            {
                registryBasePath = arguments["/registry"];
            }

            if (!String.IsNullOrEmpty(targetUser))
            {
                Console.WriteLine("[*] Target user     : {0:x}", targetUser);
            }
            Console.WriteLine("[*] Monitoring every {0} seconds for new TGTs\r\n", interval);

            var harvester = new Harvest(interval, interval, false, targetUser, registryBasePath, nowrap);

            harvester.HarvestTicketGrantingTickets();
        }
Example #5
0
        public Operation <Harvest> UpdateHarvest(Harvest harvest)
        => Operation.Try(async() =>
        {
            //verify the
            await harvest
            .ThrowIfNull(new GaiaException(PolluxErrorCodes.InvalidArgument))
            .Validate();

            var persisted = (await _queries
                             .GetHarvest(harvest.Id))
                            .ThrowIfNull(new GaiaException(ErrorCodes.InvalidStoreQueryResult));

            var farm = (await _queries
                        .GetFarm(persisted.Batch.Farm.Id))
                       .ThrowIfNull(new GaiaException(ErrorCodes.InvalidStoreQueryResult));

            //data access authorization
            await _dataAuth.AuthorizeCustomAccess(new FarmerDataAccess
            {
                Farmer = farm.Owner,
                Farm   = farm
            });

            //cannot update harvest of a published batch
            if (persisted.Batch.Status == HarvestBatchStatus.Published)
            {
                throw new GaiaException(ErrorCodes.DomainLogicError);
            }

            //make sure the new harvest product exists
            var produce = (await _queries
                           .GetFarmProduce(harvest.Produce.Id))
                          .ThrowIfNull(new GaiaException(ErrorCodes.DomainLogicError));

            //copy values
            persisted.Produce    = produce;
            persisted.Unit       = harvest.Unit;
            persisted.UnitAmount = harvest.UnitAmount;

            var storeCommand = _storeProvider.CommandFor(typeof(HarvestBatch).FullName);
            return((await storeCommand
                    .Update(persisted))
                   .ThrowIfNull(new GaiaException(ErrorCodes.InvalidStoreCommandResult)));
        });
Example #6
0
        /// <summary>
        /// Harvest Settings
        /// </summary>
        /// <param name="c"></param>
        /// <param name="packet"></param>


        public void harvestSpawned(Client c, PacketReader packet)
        {
            try
            {
                int identifier = packet.ReadInt();
                int harvestID  = packet.ReadInt();
                packet.Read();
                Point p = new Point(packet.ReadShort(), packet.ReadShort());
                if ((harvestID >= 200000 && harvestID <= 200011) || (harvestID >= 100000 && harvestID <= 100011) || (harvestID == 9702005))
                {
                    Harvest harvest = new Harvest(identifier, (HarvestType)harvestID, p);
                    c.addHarvest(harvest);
                }
            }
            catch
            {
                c.updateLog("Error Code: 400");
            }
        }
Example #7
0
        private void testTimperiods()
        {
            SubjectManager subjectManager = new SubjectManager();

            Subject subject = new Subject();

            subject.Name        = "ALTER FETTE SCHEIßE 3";
            subject.Description = "ES FUNKT 3";
            subjectManager.Create(subject);

            Sowing start = new Sowing();

            start.AssignedTo = subject;
            start.StartArea  = TimePeriodArea.Anfang;
            start.StartMonth = TimePeriodMonth.Januar;
            start.EndArea    = TimePeriodArea.Anfang;
            start.EndMonth   = TimePeriodMonth.Februar;
            start.Start      = true;


            Harvest ende = new Harvest();

            ende.AssignedTo = subject;
            ende.StartArea  = TimePeriodArea.Mitte;
            ende.StartMonth = TimePeriodMonth.März;
            ende.EndArea    = TimePeriodArea.Ende;
            ende.EndMonth   = TimePeriodMonth.Juli;
            ende.Start      = false;


            //ende = subjectManager.Create(ende);
            start.Next = ende;

            //start = subjectManager.Create(start);

            subject.TimePeriods.Add(start);
            subject.TimePeriods.Add(ende);

            subjectManager.Update(subject);


            var s = subjectManager.Get(subject.Id);
        }
            private static void Prefix(GearItem __instance)
            {
                GameObject gameObject = __instance.gameObject;

                if (__instance.m_LocalizedDisplayName?.m_LocalizationID == RECYCLED_CAN_NAME && !gameObject.GetComponent <Harvest>())
                {
                    GameObject scrapMetalObject = Resources.Load <GameObject>(SCRAP_METAL_NAME);
                    GearItem   scrapMetalItem   = scrapMetalObject?.GetComponent <GearItem>();
                    if (!scrapMetalItem)
                    {
                        return;
                    }

                    Harvest harvest = gameObject.AddComponent <Harvest>();
                    harvest.m_YieldGear       = new GearItem[] { scrapMetalItem };
                    harvest.m_YieldGearUnits  = new int[] { 1 };
                    harvest.m_DurationMinutes = 10;
                    harvest.m_Audio           = HARVEST_AUDIO;
                }
            }
Example #9
0
        private void btn_startharvest_Click(object sender, EventArgs e)
        {
            marketPrice = rn.Next(50000, 80000);
            btn_startharvest.Enabled   = false;
            btn_startharvest.BackColor = Color.Transparent;
            County plyerCOunty = new County();

            for (int i = 0; i < pickedCounties.Count; i++)
            {
                if (pickedCounties[i].ownerID == "4")
                {
                    plyerCOunty = pickedCounties[i];
                    break;
                }
            }

            Harvest harvest = new Harvest(pickedCounties, players, resultCounties, plyerCOunty, players[3], marketPrice);

            panel_main.Controls.Add(harvest);
        }
Example #10
0
        public IActionResult UpdatePlan(Harvest someHarvest)
        {
            bool    result                = false;
            Harvest originalHarvest       = harvestDAO.GetSpecificHarvest(someHarvest.harvestId);
            decimal inventoryAmountChange = originalHarvest.weight - someHarvest.weight;
            bool    inventoryResult       = inventoryDAO.DebitInventory(someHarvest.inventoryId, inventoryAmountChange);

            if (inventoryResult)
            {
                result = harvestDAO.UpdateHarvest(someHarvest);
            }
            if (result)
            {
                return(Ok("Update successful"));
            }
            else
            {
                return(BadRequest("Update failed"));
            }
        }
Example #11
0
        public IActionResult AddNewHarvest(Harvest newHarvest)
        {
            bool result = false;

            newHarvest.cropID = harvestDAO.GetCropId(newHarvest.cropName);
            int newInventoryId = inventoryDAO.AddInventory(newHarvest.cropID, newHarvest.weight, newHarvest.dateHarvested);

            if (newInventoryId != 0)
            {
                result = harvestDAO.AddNewHarvest(newHarvest, newInventoryId);
            }
            if (result)
            {
                return(Created("", result));
            }
            else
            {
                return(BadRequest());
            }
        }
Example #12
0
        public void Execute(Dictionary <string, string> arguments)
        {
            string targetUser       = "";
            int    interval         = 60;
            string registryBasePath = null;

            if (arguments.ContainsKey("/filteruser"))
            {
                targetUser = arguments["/filteruser"];
            }
            if (arguments.ContainsKey("/interval"))
            {
                interval = Int32.Parse(arguments["/interval"]);
            }
            if (arguments.ContainsKey("/registry"))
            {
                registryBasePath = arguments["/registry"];
            }
            Harvest.Monitor4624(interval, targetUser, registryBasePath);
        }
Example #13
0
        public Operation <Harvest> CreateHarvest(Guid batchId, Harvest harvest)
        => Operation.Try(async() =>
        {
            //verify the parameters
            batchId.ThrowIf(
                default(Guid),
                new GaiaException(PolluxErrorCodes.InvalidArgument));

            await harvest
            .ThrowIfNull(new GaiaException(PolluxErrorCodes.InvalidArgument))
            .Validate();

            var batch = (await _queries
                         .GetBatch(batchId))
                        .ThrowIfNull(new GaiaException(ErrorCodes.InvalidStoreQueryResult));

            var farmer = (await _queries
                          .GetFarmer(batch.Farm.Owner.Id))
                         .ThrowIfNull(new GaiaException(ErrorCodes.InvalidStoreQueryResult));

            //data access authorization: make sure the current user is the farmer that owns the farm to which the batch is being added
            await _dataAuth.AuthorizeCustomAccess(new FarmerDataAccess
            {
                Farmer = farmer,
                Farm   = batch.Farm
            });

            //cannot add a harvest to an already published batch
            if (batch.Status == HarvestBatchStatus.Published)
            {
                throw new GaiaException(ErrorCodes.DomainLogicError);
            }

            //harvest.Id = Guid.NewGuid(); //<-- this is redundant because the StoreTransformer always adds new Guids for objects being added to the store.
            harvest.Batch = batch;

            var storeCommand = _storeProvider.CommandFor(typeof(Harvest).FullName);
            return((await storeCommand
                    .Add(harvest))
                   .ThrowIfNull(new GaiaException(ErrorCodes.InvalidStoreCommandResult)));
        });
Example #14
0
        public void SetHarvestStatisticsTwoElementListTest()
        {
            var harvest1 = new Harvest()
            {
                Amount   = 10,
                DateTime = DateTime.Now,
                Employee = new Employee()
                {
                    FirstName = "First1", LastName = "Last1"
                },
                Id = 1
            };
            var harvest2 = new Harvest()
            {
                Amount   = 20,
                DateTime = DateTime.Now,
                Employee = new Employee()
                {
                    FirstName = "First2", LastName = "Last2"
                },
                Id = 2
            };
            var harvest3 = new Harvest()
            {
                Amount   = 30,
                DateTime = DateTime.Now,
                Employee = new Employee()
                {
                    FirstName = "First3", LastName = "Last3"
                },
                Id = 3
            };
            var harvests = new List <Harvest>()
            {
                harvest1, harvest2, harvest3
            };
            var model = new HomePageVM();

            model.SetHarvestStatistics(harvests);
            Assert.AreEqual($"Zebrane kilogramy: 60", model.DropedInfo);
        }
        public HttpResponseMessage Put([FromBody] Harvest harvest)
        {
            int numEffected = 0;

            try
            {
                numEffected = harvest.Update();

                if (numEffected > 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, numEffected));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Not Found"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Example #16
0
        private static bool Prefix(Panel_Inventory_Examine __instance)
        {
            if (GameManager.GetWeatherComponent().IsTooDarkForAction(ActionsToBlock.Harvest))
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_RequiresLightToHarvest"), false);
                GameAudioManager.PlayGUIError();
                return(false);
            }
            Harvest component = __instance.m_GearItem.GetComponent <Harvest>();

            Debug.Log("gear:" + component.m_YieldGear[0].name);
            if (component.m_YieldGear[0].name == "GEAR_Stick")
            {
                __instance.m_HarvestTimeSeconds /= 6.0f;
            }
            __instance.StartHarvest(component.m_DurationMinutes, component.m_Audio);
            if (component.m_YieldGear[0].name == "GEAR_Stick")
            {
                __instance.m_HarvestTimeSeconds *= 6.0f;
            }
            return(false);
        }
Example #17
0
        internal static void Configure(ModComponent modComponent)
        {
            ModHarvestableComponent modHarvestableComponent = ModUtils.GetComponent <ModHarvestableComponent>(modComponent);

            if (modHarvestableComponent == null)
            {
                return;
            }

            Harvest harvest = ModUtils.GetOrCreateComponent <Harvest>(modHarvestableComponent);

            harvest.m_Audio           = modHarvestableComponent.Audio;
            harvest.m_DurationMinutes = modHarvestableComponent.Minutes;

            if (modHarvestableComponent.YieldNames.Length != modHarvestableComponent.YieldCounts.Length)
            {
                throw new ArgumentException("YieldNames and YieldCounts do not have the same length on gear item '" + modHarvestableComponent.name + "'.");
            }

            harvest.m_YieldGear      = ModUtils.GetItems <GearItem>(modHarvestableComponent.YieldNames, modHarvestableComponent.name);
            harvest.m_YieldGearUnits = modHarvestableComponent.YieldCounts;
        }
        public HttpResponseMessage Delete([FromBody] string row_num) // row = row number in DB
        {
            int     numEffected = 0;
            Harvest harv        = new Harvest();

            try
            {
                numEffected = harv.delete_line(Convert.ToInt32(row_num));

                if (numEffected > 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, numEffected));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Not Found"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Example #19
0
        public override void Up()
        {
            var systemPath = AppDomain.CurrentDomain.BaseDirectory + @"..\App_Data\Data.csv";
            var openFile   = File.ReadAllLines(systemPath);

            foreach (string row in openFile)
            {
                var     data       = row.Split(',');
                Harvest newHarvest = new Harvest
                {
                    number         = data[0],
                    name           = data[1],
                    type           = data[2],
                    permits        = data[3],
                    hunters_afield = data[4],
                    harvest        = data[5],
                    average_days   = data[6],
                    success        = data[7],
                };
                db.Harvests.Add(newHarvest);
            }
            db.SaveChanges();
        }
Example #20
0
        private void btnSaveHarv_Click(object sender, EventArgs e)
        {
            dbconn.connect();

            MySqlCommand labourerValidation = new MySqlCommand("SELECT labourerName = @user FROM harvestTask WHERE (startDate >= @startDate AND endDate <= @endDate)", dbconn.getConn());

            labourerValidation.Parameters.AddWithValue("@user", comboBoxWorkerHarv.Text);
            labourerValidation.Parameters.AddWithValue("@startDate", dateTimePickerHrStartDate.Value.Date);
            labourerValidation.Parameters.AddWithValue("@endDate", dateTimePickerHrvEndDate.Value.Date);
            MySqlDataReader reader = labourerValidation.ExecuteReader();

            if (reader.HasRows)
            {
                MessageBox.Show("Labourer is already assigned to a task!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                reader.Close();
            }
            else
            {
                dbconn.connect();
                Harvest harv = new Harvest();
                harv.LabourerName = comboBoxWorkerHarv.Text;
                harv.FarmSector   = int.Parse(comboBoxFarmSectorHarv.Text);
                harv.TaskStatus   = comBoxHvTaskStatus.Text;
                harv.StartDate    = dateTimePickerHrStartDate.Value.Date;
                harv.EndDate      = dateTimePickerHrvEndDate.Value.Date;
                harv.Method       = comboBoxHarvestMehtod.Text;
                harv.Machine      = comboBoxPlantType.Text;
                harv.StorageUnit  = comboBoxStorageUnit.Text;
                harv.StartTime    = dateTimePickerStartHarv.Value;
                harv.EndTime      = dateTimePickerEndHarv.Value;

                ScheduleHandler scHand = new ScheduleHandler();
                scHand.addHarvestSchedule(dbconn.getConn(), harv);
                MessageBox.Show("Task Assigned!");
            }
        }
        public Harvest GetSpecificHarvest(int harvestId)
        {
            Harvest currentHarvest = new Harvest();

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();

                SqlCommand cmd = new SqlCommand(sqlSelectSpecificHarvest, conn);
                cmd.Parameters.AddWithValue("@harvestId", harvestId);
                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read() == true)
                {
                    currentHarvest.harvestId     = Convert.ToInt32(reader["harvest_id"]);
                    currentHarvest.cropID        = Convert.ToInt32(reader["crop_id"]);
                    currentHarvest.cropName      = Convert.ToString(reader["crop_name"]);
                    currentHarvest.area          = Convert.ToString(reader["area_identifier"]);
                    currentHarvest.weight        = Convert.ToDecimal(reader["weight_count"]);
                    currentHarvest.dateHarvested = Convert.ToDateTime(reader["date_harvested"]);
                }
                return(currentHarvest);
            }
        }
	/// <summary>
	/// Initializes a new instance of the <see cref="MessageHarvestExecuted"/> class.
	/// </summary>
	/// <param name='harvest'>
	/// Harvest.
	/// </param>
	/// <param name='products'>
	/// Products.
	/// </param>
	public MessageHarvestExecuted(Harvest harvest, Harvest.Products products):base(listenerType)
	{
		this.harvest = harvest;
		this.products = products;
	}
	/// <summary>
	/// Executes the harvests.
	/// </summary>
	/// <returns>
	/// The harvests to execute.
	/// </returns>
	private IEnumerator ExecuteHarvests(Harvest[] harvests)
	{
		m_actionProgress = 0f;
		float div = 1f/harvests.Length;
		foreach (Harvest harvest in harvests) {
			yield return StartCoroutine(harvest.DoIt());
			m_actionProgress += div;
		}
		m_actionProgress = 1f;
	}
Example #24
0
 void Start()
 {
     harvest = GameObject.Find ("Harvest").GetComponent<Harvest>();
     guiOn = false;
     clicked = true;
     int width = 300, height = 50;
     Icost = 4000;
     Pcost = 600;
     Fcost = 250;
     windowRect = new Rect((Screen.width-width)/2,(Screen.height-height)/2,width,height);
     Debug.Log(Screen.height);
     savings = int.Parse(GameObject.FindGameObjectWithTag("Savings").GetComponent<Text>().text);
     GetComponent<Button>().interactable = true;
     clicked = true;
     flag=-1;
 }
	/// <summary>
	/// Schedules the harvest.
	/// </summary>
	/// <param name='harvest'>
	/// Harvest.
	/// </param>
	public void ScheduleHarvest(Harvest harvest)
	{
		m_harvests.Add(harvest);
	}
        public async Task Post([FromBody] HarvestDTO value)
        {
            Harvest entity = _mapper.Map <HarvestDTO, Harvest>(value);

            await _service.Add(entity);
        }
Example #27
0
    void Update()
    {
        //distance to player from agent (deer)
        distance = Vector3.Distance(player.position, transform.position);

        switch (currentState)
        {
        case DeerState.Eating:
        {
            agent.speed = 0;
            if (isWandering == false)
            {
                StartCoroutine(Wander());
            }

            if (isWalking)
            {
                currentState = DeerState.Walking;
            }
            else
            {
                animator.SetBool("isWalking", false);
                animator.SetBool("isRunning", false);
                animator.SetBool("isEating", true);
            }

            if (distance <= lookRadius && ToolSwitching.huntingToolEquiped)
            {
                currentState = DeerState.Running;
            }

            break;
        }

        case DeerState.Running:
        {
            RunAway();

            if (distance > runAwayRadius)
            {
                currentState = DeerState.Eating;
            }

            Harvest harvestScript = gameObject.GetComponent <Harvest>();
            if (harvestScript.health <= 0)
            {
                currentState = DeerState.Dieing;
            }

            break;
        }

        case DeerState.Walking:
        {
            //decides the rotation / direction to face
            if (isRotRight == true)
            {
                agent.transform.Rotate(transform.up * Time.deltaTime * rotSpeed);
            }

            if (isRotLeft == true)
            {
                agent.transform.Rotate(transform.up * Time.deltaTime * -rotSpeed);
            }

            animator.SetBool("isRunning", false);
            animator.SetBool("isEating", false);
            animator.SetBool("isWalking", true);

            agent.speed = walkSpeed;
            agent.transform.position += transform.forward * walkSpeed * Time.deltaTime;

            //distance = distance between player and the deer
            if (distance <= lookRadius && ToolSwitching.huntingToolEquiped)
            {
                currentState = DeerState.Running;
            }

            if (isWandering == false)
            {
                currentState = DeerState.Eating;
            }

            break;
        }

        case DeerState.Dieing:
        {
            agent.speed = 0;
            animator.SetBool("isRunning", false);
            animator.SetBool("isDead", true);

            break;
        }
        }
    }
 public int Post([FromBody] Harvest harv)
 {
     return(harv.insert());
 }
        public List <Harvest> Get()
        {
            Harvest harvest = new Harvest();

            return(harvest.get_Harvest());
        }
	/// <summary>
	/// Submits the resource tile selection to server API.
	/// </summary>
	/// <remarks>
	/// This differs from the base implementation because the API returns timber values, not modified resource tiles
	/// </remarks>
	/// <returns>
	/// The resource tile selection to server API.
	/// </returns>
	/// <param name='selection'>
	/// The resource tile selection.
	/// </param>
	protected override IEnumerator SubmitResourceTileSelectionToServerAPI(ResourceTileSelection selection)
	{
		//HACK -- HACK -- HACK -- HACK
		/*selection = FilterSelection(selection);
		if (selection.Count() <= 0) {
			Debug.LogError("No tiles in the selection can have an action performed on them.");
			yield break;
		}*/
		//END HACK
		
		
		// initialize a clearcut
		Harvest harvest = new Harvest(selection.ToArray(), 1);
		// configure harvest to perform
		if (m_cutType == CutType.DiameterLimitCut) {
			harvest = new Harvest(
				selection.ToArray(), 1,
				m_diameterLimit, m_diameterLimitDirection
			);
		} else if (m_cutType == CutType.QRatioCut) {
			harvest = new Harvest(
				selection.ToArray(), 1,
				m_qRatio, m_basalArea
			);
		}
		// perform harvest (50% of action progress)
		StartCoroutine(harvest.DoIt());
		while (harvest.progress < 1f) {
			m_actionProgress = 0.5f*harvest.progress;
			if (!string.IsNullOrEmpty(harvest.doItError)) {
				Debug.LogError(harvest.doItError);
				StartCoroutine(RefreshAfterActionFailed(harvest.doItError));
				yield break;
			}
			yield return 0;
		}
		// get updated tiles (100% of action progress)
		/*List<ResourceTile> tiles = new List<ResourceTile>();
		float div = 1f/selection.Count();
		HTTP.Request request;
		for (int i=0; i<selection.Count(); ++i) {
			int id = selection[i];
			request = new HTTP.Request( "Get", WebRequests.GetURLToResourceTile(id) );
			request.AddParameters( WebRequests.authenticatedParameters );
			request.Send();
			
			while (!request.isDone) {
				//m_actionProgress = 0.5f*(1f+(i+www.progress)*div);
				yield return 0;
			}
			if( request.ProducedError ) {
				m_actionProgress = 1f;
				yield break;
			}
			try {
				tiles.Add(JSONDecoder.Decode<IndividualResourceTile>(request.response.Text).resource_tile);
			}
			catch (JsonException) {
				//Debug.LogError(www.text);
			}
		}*/
		// conclude the action
		ConcludeActionOnResourceTiles(selection);
		GameManager.use.worldDataIsValid = false;
		TerrainManager.use.RefreshFromIds(selection.resource_tile_ids.ToArray());
		IEnumerator e = WebRequests.DownloadPlayerData(Player.current);
		while (e.MoveNext()) {
			yield return 0;
		}
	}
 void Start()
 {
     bc = GameObject.Find ("Blocks").GetComponent<BlocksController>();
     harvest = GameObject.Find ("Harvest").GetComponent<Harvest>();
     guiOn = false;
     int width = 700, height = 80;
     savings = int.Parse(GameObject.FindGameObjectWithTag("Savings").GetComponent<Text>().text);
     windowRect = new Rect((Screen.width-width)/2,(Screen.height-height)/2,width,height);
     flag = -1;
 }
Example #32
0
        private List <DbValidationError> GetHarvestValidationErrors(HarvestRepository pr, Harvest contact, HarvestDTO cqDto, int companyId, int PondId)
        {
            contact.ProcessRecord(cqDto);

            return(pr.Validate(contact));
        }
Example #33
0
        public void harvestTest()
        {
            int harvest1 = Harvest.HarvestTwoSections(new int[] { 20, 20, 20, 0, 0, 0, 10, 10 }, 3, 2);

            Assert.Equals(harvest1, 80);
        }
Example #34
0
 void Start()
 {
     harvest = GameObject.Find ("Harvest").GetComponent<Harvest>();
 }
	/// <summary>
	/// Initializes a new instance of the <see cref="MessageHarvestEnded"/> class.
	/// </summary>
	/// <param name='harvest'>
	/// Harvest.
	/// </param>
	public MessageHarvestEnded(Harvest harvest):base(listenerType)
	{
		this.harvest = harvest;
	}
Example #36
0
        public void HarvestPlant()
        {
            propogationNursery.Click();
            Thread.Sleep(1000);
            propogationGarden.Click();
            prodViewViablePlants.Click();
            Thread.Sleep(2000);
            workRoom.Click();
            Thread.Sleep(1000);
            genAg.Click();
            Thread.Sleep(1000);
            filterBySelection.Click();
            Thread.Sleep(2000);
            selectedPlant.Click();
            Thread.Sleep(2000);
            wareHouseLocation.Click();
            Thread.Sleep(1000);
            selectWarehouse.Click();
            Thread.Sleep(1000);
            chooseWareHouse.Click();
            Thread.Sleep(1000);
            Move.Click();
            Thread.Sleep(2000);

            Console.WriteLine("Move Plant To Vegetation - PASS");

            Vegetating.Click();
            Thread.Sleep(1000);
            genAgVeg.Click();
            Thread.Sleep(2000);
            filterBySelection.Click();
            Thread.Sleep(2000);
            selectedPlant.Click();
            Thread.Sleep(1000);
            wareHouseLocation.Click();
            Thread.Sleep(1000);
            selectWarehouse.Click();
            Thread.Sleep(1000);
            chooseWareHouse.Click();
            Thread.Sleep(1000);
            Move.Click();
            Thread.Sleep(1000);

            Console.WriteLine("Move Plant to Flowering - PASS");

            Flowering.Click();
            Thread.Sleep(2000);
            workRoom.Click();
            Thread.Sleep(1000);
            genAgFlow.Click();
            Thread.Sleep(2000);
            filterBySelection.Click();
            Thread.Sleep(2000);
            selectedPlant.Click();
            Thread.Sleep(1000);
            Harvest.Click();
            Thread.Sleep(2000);
            new SelectElement(destinationWH).SelectByValue("Harvest Room");
            new SelectElement(harvestType).SelectByValue("Full");
            Thread.Sleep(1000);
            harvestName.SendKeys("biraz2");
            Thread.Sleep(2000);
            harvestTotal.SendKeys("22");
            Thread.Sleep(2000);
            harChkBox.Click();
            Thread.Sleep(2000);
            Apply.Click();
            Thread.Sleep(3000);

            Console.WriteLine("Harvest Plant - PASS");

            cancelButton.Click();
        }
Example #37
0
        /// <summary>
        /// Command list for the game
        /// </summary>
        /// <param name="commandOptions">Everything after the 1st occurance of a space</param>
        /// <param name="commandKey">The string before the 1st occurance of a space</param>
        /// <param name="playerData">Player Data</param>
        /// <param name="room">Current room</param>
        /// <returns>Returns Dictionary of commands</returns>
        public static void Commands(string commandOptions, string commandKey, PlayerSetup.Player playerData, Room.Room room)
        {
            var context = HubContext.Instance;

            switch (commandKey)
            {
            case "north":
                Movement.Move(playerData, room, "North");
                break;

            case "east":
                Movement.Move(playerData, room, "East");
                break;

            case "south":
                Movement.Move(playerData, room, "South");
                break;

            case "west":
                Movement.Move(playerData, room, "West");
                break;

            case "up":
                Movement.Move(playerData, room, "Up");
                break;

            case "down":
                Movement.Move(playerData, room, "Down");
                break;

            case "look":
            case "look at":
            case "l at":
            case "search":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "look");
                break;

            case "l in":
            case "search in":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "look in");
                break;

            case "examine":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "examine");
                break;

            case "touch":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "touch");
                break;

            case "smell":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "smell");
                break;

            case "taste":
                LoadRoom.ReturnRoom(playerData, room, commandOptions, "taste");
                break;

            case "score":
                Score.ReturnScore(playerData);
                break;

            case "inventory":
                Inventory.ReturnInventory(playerData.Inventory, playerData);
                break;

            case "eq":
            case "equip":
            case "equipment":
            case "garb":
                Equipment.ShowEquipment(playerData);
                break;

            case "loot":
            case "get":
            case "take":
                ManipulateObject.GetItem(room, playerData, commandOptions, commandKey, "item");
                break;

            case "plunder":
                ManipulateObject.GetItem(room, playerData, "all " + commandOptions, commandKey, "item");
                break;

            case "drop":
            case "put":
                ManipulateObject.DropItem(room, playerData, commandOptions, commandKey);
                break;

            case "give":
                ManipulateObject.GiveItem(room, playerData, commandOptions, commandKey, "killable");
                break;

            case "save":
                Save.SavePlayer(playerData);
                break;

            case "say":
            case "'":
                Communicate.Say(commandOptions, playerData, room);
                break;

            case "sayto":
            case ">":
                Communicate.SayTo(commandOptions, room, playerData);
                break;

            case "newbie":
                Communicate.NewbieChannel(commandOptions, playerData);
                break;

            case "gossip":
                Communicate.GossipChannel(commandOptions, playerData);
                break;

            case "ooc":
                Communicate.OocChannel(commandOptions, playerData);
                break;

            case "yes":
                Communicate.Say("Yes", playerData, room);
                break;

            case "no":
                Communicate.Say("No", playerData, room);
                break;

            case "yell":
                Communicate.Yell(commandOptions, room, playerData);
                break;

            case "talkto":
                Talk.TalkTo(commandOptions, room, playerData);
                break;

            case "emote":
                Emote.EmoteActionToRoom(commandOptions, playerData);
                break;

            case "use":
            case "wear":
            case "wield":
                Equipment.WearItem(playerData, commandOptions);
                break;

            case "remove":
            case "doff":
            case "unwield":
                Equipment.RemoveItem(playerData, commandOptions);
                break;

            case "hit":
            case "kill":
            case "attack":
                Fight2.PerpareToFight(playerData, room, commandOptions);
                break;

            case "flee":
                Flee.fleeCombat(playerData, room);
                break;

            case "sacrifice":
            case "harvest":
                Harvest.Body(playerData, room, commandOptions);
                break;

            case "peek":
                Peak.DoPeak(context, playerData, room, commandOptions);
                break;

            case "steal":
                Steal.DoSteal(context, playerData, room, commandOptions);
                break;

            case "pick":
                LockPick.DoLockPick(context, playerData, room, commandOptions);
                break;

            case "c magic missile":
            case "cast magic missile":
                MagicMissile.StartMagicMissile(playerData, room, commandOptions);
                break;

            case "c armour":
            case "cast armour":
            case "c armor":
            case "cast armor":
                new Armour().StartArmour(playerData, room, commandOptions);
                break;

            case "c continual light":
            case "cast continual light":
                ContinualLight.StarContinualLight(playerData, room, commandOptions);
                break;

            case "c invis":
            case "cast invis":
                Invis.StartInvis(playerData, room, commandOptions);
                break;

            case "c weaken":
            case "cast weaken":
                Weaken.StartWeaken(playerData, room, commandOptions);
                break;

            case "c chill touch":
            case "cast chill touch":
                ChillTouch.StartChillTouch(playerData, room, commandOptions);
                break;

            case "c fly":
            case "cast fly":
                Fly.StartFly(playerData, room, commandOptions);
                break;

            case "c refresh":
            case "cast refresh":
                Refresh.StartRefresh(playerData, room, commandOptions);
                break;

            case "c faerie fire":
            case "cast faerie fire":
                FaerieFire.StartFaerieFire(playerData, room, commandOptions);
                break;

            case "c teleport":
            case "cast teleport":
                Teleport.StartTeleport(playerData, room);
                break;

            case "c blindness":
            case "cast blindness":
                Blindness.StartBlind(playerData, room, commandOptions);
                break;

            case "c haste":
            case "cast haste":
                Haste.StartHaste(playerData, room, commandOptions);
                break;

            case "c create spring":
            case "cast create spring":
                CreateSpring.StartCreateSpring(playerData, room);
                break;

            case "c shocking grasp":
            case "cast shocking grasp":
                new ShockingGrasp().StartShockingGrasp(playerData, room, commandOptions);
                break;

            case "c cause light":
            case "cast cause light":
                new CauseLight().StartCauseLight(context, playerData, room, commandOptions);
                break;

            case "c cure light":
            case "cast cure light":
                new CureLight().StartCureLight(context, playerData, room, commandOptions);
                break;

            case "c cure blindness":
                new CureBlindness().StartCureBlindness(context, playerData, room, commandOptions);
                break;

            case "c detect invis":
            case "cast detect invis":
                DetectInvis.DoDetectInvis(context, playerData, room);
                break;

            case "forage":
                new Foraging().StartForaging(playerData, room);
                break;

            case "fish":
            case "angle":
            case "line":
            case "trawl":
            case "lure":
                new Fishing().StartFishing(playerData, room);
                break;

            case "reel":
                Fishing.GetFish(playerData, room);
                break;

            case "dirt kick":
                new DirtKick().StartDirtKick(context, playerData, room, commandOptions);
                break;

            case "bash":
                new Bash().StartBash(context, playerData, room, commandOptions);
                break;

            case "shield bash":
                new ShieldBash().StartBash(context, playerData, room, commandOptions);
                break;

            case "punch":
                Punch.StartPunch(playerData, room);
                break;

            case "kick":
                new Kick().StartKick(context, playerData, room, commandOptions);
                break;

            case "spin kick":
                new SpinKick().StartKick(context, playerData, room, commandOptions);
                break;

            case "rescue":
                new Rescue().StartRescue(context, playerData, room, commandOptions);
                break;

            case "lunge":
                new Lunge().StartLunge(context, playerData, room, commandOptions);
                break;

            case "disarm":
                new Disarm().StartDisarm(context, playerData, room);
                break;

            case "backstab":
                new Backstab().StartBackstab(context, playerData, room, commandOptions);
                break;

            case "feint":
                new Feint().StartFeint(context, playerData, room, commandOptions);
                break;

            case "mount":
            case "ride":
                Mount.StartMount(playerData, room, commandOptions);
                break;

            case "dismount":
                Mount.Dismount(playerData, room, commandOptions);
                break;

            case "trip":
                new Trip().StartTrip(context, playerData, room, commandOptions);
                break;

            case "sneak":
                Sneak.DoSneak(context, playerData);
                break;

            case "hide":
                Hide.DoHide(context, playerData);
                break;

            case "lore":
                Lore.DoLore(context, playerData, commandOptions);
                break;

            case "unlock":
                ManipulateObject.UnlockItem(room, playerData, commandOptions, commandKey);
                break;

            case "lock":
                ManipulateObject.LockItem(room, playerData, commandOptions, commandKey);
                break;

            case "close":
            case "shut":
                ManipulateObject.Close(room, playerData, commandOptions, commandKey);
                break;

            case "drink":
                ManipulateObject.Drink(room, playerData, commandOptions, commandKey);
                break;

            case "help":
            case "/help":
            case "?":
            case "commands":
                Help.ShowHelp(commandOptions, playerData);
                break;

            case "time":
            case "clock":
                Update.Time.ShowTime();
                break;

            case "skills":
            case "spells":
            case "skills all":
                ShowSkills.ShowPlayerSkills(playerData, commandOptions);
                break;

            case "practice":
                Trainer.Practice(playerData, room, commandOptions);
                break;

            case "list":
                Shop.listItems(playerData, room);
                break;

            case "buy":
                Shop.buyItems(playerData, room, commandOptions);
                break;

            case "sell":
                Shop.sellItems(playerData, room, commandOptions);
                break;

            case "quest log":
            case "qlog":
                Quest.QuestLog(playerData);
                break;

            case "wake":
                Status.WakePlayer(context, playerData, room);
                break;

            case "sleep":
                Status.SleepPlayer(context, playerData, room);
                break;

            case "rest":
            case "sit":
                Status.RestPlayer(context, playerData, room);
                break;

            case "stand":
                Status.StandPlayer(context, playerData, room);
                break;

            case "greet":
                Greet.GreetMob(playerData, room, commandOptions);
                break;

            case "who":
                Who.Connected(playerData);
                break;

            case "affects":
                Effect.Show(playerData);
                break;

            case "follow":
                Follow.FollowThing(playerData, room, commandOptions);
                break;

            case "nofollow":
                Follow.FollowThing(playerData, room, "noFollow");
                break;

            case "quit":
                HubContext.Instance.Quit(playerData.HubGuid, room);
                break;

            case "craft":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Craft);
                break;

            case "chop":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Chop);
                break;

            case "cook":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Cook);
                break;

            case "brew":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Brew);
                break;

            case "forge":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Forge);
                break;

            case "carve":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Carve);
                break;

            case "knit":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Knitting);
                break;

            case "make":
            case "build":
                Craft.CraftItem(playerData, room, commandOptions, CraftType.Craft);
                break;

            case "show crafts":
            case "craftlist":
                Craft.CraftList(playerData);
                break;

            case "set up camp":
                Camp.SetUpCamp(playerData, room);
                break;

            case "repair":
                Events.Repair.RepairItem(playerData, room, commandOptions);
                break;

            case "/debug":
                PlayerSetup.Player.DebugPlayer(playerData);
                break;

            case "/setGold":
                PlayerSetup.Player.SetGold(playerData, commandOptions);
                break;

            case "/setAc":
                PlayerSetup.Player.SetAC(playerData, commandOptions);
                break;

            case "/map":
                SigmaMap.DrawMap(playerData.HubGuid);     //not what you think it does
                break;

            default:
                HubContext.Instance.SendToClient("Sorry you can't do that. Try help commands or ask on the discord channel.", playerData.HubGuid);
                var log = new Error.Error
                {
                    Date         = DateTime.Now,
                    ErrorMessage = commandKey + " " + commandOptions,
                    MethodName   = "Wrong command"
                };

                Save.LogError(log);
                break;
            }
        }
	/// <summary>
	/// Displays the history of the supplied harvest as a line graph.
	/// </summary>
	/// <returns>
	/// The tooltip for the current point, if any.
	/// </returns>
	/// <param name='parent'>
	/// The parent rectangle
	/// </param>
	/// <param name='harvest'>
	/// Harvest.
	/// </param>
	/// <param name='currentTab'>
	/// Current tab.
	/// </param>
	/// <param name='poleTimberSeries'>
	/// Pole timber point style.
	/// </param>
	/// <param name='sawTimberSeries'>
	/// Saw timber point style.
	/// </param>
	/// <param name='lineGraphMaterial'>
	/// Line graph material.
	/// </param>
	public static string DisplayHarvestHistoryGraph(
		Rect parent,
		Harvest harvest, HistoryTab currentTab,
		TimeSeries poleTimberSeries, TimeSeries sawTimberSeries,
		Material lineGraphMaterial
	)
	{
		// create space in the layout and store it
		Rect placeholder = GUILayoutUtility.GetRect(
			//BottomTrayGUI.use.rectActionControls.width*0.5f, // min width
			//BottomTrayGUI.use.rectActionControls.width, // max width
			150f, 300f,
			m_histogramHeight, // min height
			m_histogramHeight // max height
		);
		if (Event.current.type == EventType.Repaint) {
			m_lineGraphRect = GUILayoutUtility.GetLastRect();
		}
		// determine max value for ordinate
		float maxOrdinate = 0f;
		if (currentTab == HistoryTab.Value) {
			foreach (Harvest.Products products in harvest.history) {
				maxOrdinate = Mathf.Max(maxOrdinate, products.poletimberValue);
				maxOrdinate = Mathf.Max(maxOrdinate, products.sawtimberValue);
			}
		} else {
			foreach (Harvest.Products products in harvest.history) {
				maxOrdinate = Mathf.Max(maxOrdinate, products.poletimberVolume);
				maxOrdinate = Mathf.Max(maxOrdinate, products.sawtimberVolume);
			}
		}
		// graph gui
		Color currentGUIColor = GUI.color;
		GUI.BeginGroup(m_lineGraphRect); {
			// allocations for background
			Color opaqueLine = GUI.color;
			Color fadeLine = new Color(opaqueLine.r, opaqueLine.g, opaqueLine.b, opaqueLine.a * 0.5f);
			Rect r = new Rect();
			int numLines = 5;
			float div = 1f/numLines;
			bool fill = true;
			GUIStyle labelStyle = GameGUIManager.use.styles.smallTextMedium;
			// draw background
			for (int i=0; i<numLines; ++i) {
				// ordinate number
				r.width = m_lineGraphRect.width; r.x = 0f;
				r.height = m_lineGraphRect.height*div; r.y = r.height*i;
				GUI.Label(r, string.Format("{0:0,0}", maxOrdinate*div*(numLines-i)), labelStyle);
				// line
				if (fill) {
					GUI.color = fadeLine;
					GUI.DrawTexture(r, GameGUIManager.use.styles.histogramBar.active.background, ScaleMode.StretchToFill);
					GUI.color = opaqueLine;
				}
				fill = !fill;
			}
			// get points
			Vector2[] poleTimberPoints = new Vector2[harvest.history.Length];
			Vector2[] sawTimberPoints = new Vector2[harvest.history.Length];
			float divOrdinate = 1f/maxOrdinate;
			float divAbcissa = m_lineGraphRect.width/(harvest.duration-1);
			if (currentTab == HistoryTab.Value) {
				for (int i=0; i<harvest.history.Length; ++i) {
					poleTimberPoints[i] = new Vector2(divAbcissa*i, divOrdinate*harvest.history[i].poletimberValue*m_histogramHeight);
					sawTimberPoints[i] = new Vector2(divAbcissa*i, divOrdinate*harvest.history[i].sawtimberValue*m_histogramHeight);
				}
			}
			else {
				for (int i=0; i<harvest.history.Length; ++i) {
					poleTimberPoints[i] = new Vector2(divAbcissa*i, divOrdinate*harvest.history[i].poletimberVolume*m_histogramHeight);
					sawTimberPoints[i] = new Vector2(divAbcissa*i, divOrdinate*harvest.history[i].sawtimberVolume*m_histogramHeight);
				}
			}
			// draw lines
			if (Event.current.type == EventType.Repaint) {
				Vector2 corner = new Vector2(
					parent.x+placeholder.x,
					Screen.height-parent.y-placeholder.y-placeholder.height
				);
				DrawLineInGraph(poleTimberSeries, poleTimberPoints, lineGraphMaterial, corner);
				DrawLineInGraph(sawTimberSeries, sawTimberPoints, lineGraphMaterial, corner);
			}
			// draw points
			for (int i=0; i<harvest.history.Length; ++i) {
				// draw poletimber point
				DrawPointInGraph(
					poleTimberSeries, poleTimberPoints[i],
					string.Format(
						"Pole Timber Year {0:0}: {1}", i+1,
						currentTab==HistoryTab.Value?
						string.Format("{0:c}", harvest.history[i].poletimberValue):
						string.Format("{0:0} cords", harvest.history[i].poletimberVolume)
					)
				);
				// draw sawtimber point
				DrawPointInGraph(
					sawTimberSeries, sawTimberPoints[i],
					string.Format(
						"Saw Timber Year {0:0}: {1}", i+1,
						currentTab==HistoryTab.Value?
						string.Format("{0:c}", harvest.history[i].sawtimberValue):
						string.Format("{0:0} board feed", harvest.history[i].sawtimberVolume)
					)
				);
			}
		} GUI.EndGroup();
		GUI.color = currentGUIColor;
		// axis labels
		GUILayout.BeginHorizontal(); {
			for (int i=0; i<harvest.duration; ++i) {
				GUILayout.Label(
					string.Format("{0}", i+1),
					GameGUIManager.use.styles.smallTextMedium
				);
				if (i<harvest.duration-1) {
					GUILayout.FlexibleSpace();
				}
			}
		} GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal(); {
			GUILayout.FlexibleSpace();
			GUILayout.Label("Harvest Year", GameGUIManager.use.styles.smallTextLight);
			GUILayout.FlexibleSpace();
		} GUILayout.EndHorizontal();
		// return the tooltip if the mouse is in the graph
		return (placeholder.Contains(Event.current.mousePosition)?GUI.tooltip:"");
	}
	/// <summary>
	/// Concludes the harvest.
	/// </summary>
	/// <param name='harvest'>
	/// Harvest.
	/// </param>
	private IEnumerator ConcludeHarvest(Harvest harvest)
	{
		m_harvests.Remove(harvest);
		while (isActionInProgress) { // wait for action to finish
			yield return 0;
		}
		m_tileModifications.resource_tile = new ModifiedFields(false);
		base.DoIt(new ResourceTileSelection(harvest.ids));
		m_currentlySelectedHarvestIndex = m_currentlySelectedHarvestIndex;
		MessengerAM.Send(new MessageHarvestEnded(harvest));
	}
Example #40
0
 private void CreateNewAccount()
 {
     account = new Account_Mock();
     harvest = new Harvest(account);
 }
Example #41
0
        public void Execute(Dictionary <string, string> arguments)
        {
            Console.WriteLine("[*] Action: TGT Harvesting (with auto-renewal)");

            string targetUser       = null;
            int    monitorInterval  = 60;   // how often to check for new TGTs
            int    displayInterval  = 1200; // how often to display the working set of TGTs
            string registryBasePath = null;
            bool   nowrap           = false;
            int    runFor           = 0;

            if (arguments.ContainsKey("/nowrap"))
            {
                nowrap = true;
            }
            if (arguments.ContainsKey("/filteruser"))
            {
                targetUser = arguments["/filteruser"];
            }
            if (arguments.ContainsKey("/targetuser"))
            {
                targetUser = arguments["/targetuser"];
            }
            if (arguments.ContainsKey("/interval"))
            {
                monitorInterval = Int32.Parse(arguments["/interval"]);
                displayInterval = Int32.Parse(arguments["/interval"]);
            }
            if (arguments.ContainsKey("/monitorinterval"))
            {
                monitorInterval = Int32.Parse(arguments["/monitorinterval"]);
            }
            if (arguments.ContainsKey("/displayinterval"))
            {
                displayInterval = Int32.Parse(arguments["/displayinterval"]);
            }
            if (arguments.ContainsKey("/registry"))
            {
                registryBasePath = arguments["/registry"];
            }
            if (arguments.ContainsKey("/runfor"))
            {
                runFor = Int32.Parse(arguments["/runfor"]);
            }

            if (!String.IsNullOrEmpty(targetUser))
            {
                Console.WriteLine("[*] Target user     : {0:x}", targetUser);
            }
            Console.WriteLine("[*] Monitoring every {0} seconds for new TGTs", monitorInterval);
            Console.WriteLine("[*] Displaying the working TGT cache every {0} seconds", displayInterval);
            if (runFor > 0)
            {
                Console.WriteLine("[*] Running collection for {0} seconds", runFor);
            }
            Console.WriteLine("");

            var harvester = new Harvest(monitorInterval, displayInterval, true, targetUser, registryBasePath, nowrap, runFor);

            harvester.HarvestTicketGrantingTickets();
        }
Example #42
0
 void Start()
 {
     harvest = GameObject.Find ("Harvest").GetComponent<Harvest>();
     ops = GameObject.Find ("Opportunity").GetComponent<Opportunity>();
 }
Example #43
0
    public void LoadGame(string saveFile, string saveType)
    {
        if (!Directory.Exists(Application.persistentDataPath + "/game_save/" + saveFile))
        {
            return;
        }
        BinaryFormatter bf = new BinaryFormatter();

        if (File.Exists(Application.persistentDataPath + "/game_save/" + saveFile + "/" + saveType))
        {
            FileStream file = File.Open(Application.persistentDataPath + "/game_save/" + saveFile + "/" + saveType, FileMode.Open);


            //handle save types
            if (saveType == "inventory.txt")
            {
                JsonUtility.FromJsonOverwrite((string)bf.Deserialize(file), inventoryData);

                //removing old inventory
                for (int i = 0; i < inventorySize; i++)
                {
                    Slot currentSlot = inventory.slots[i].GetComponent <Slot>();
                    currentSlot.myAmount = 0;

                    if (currentSlot.myImage != null)
                    {
                        currentSlot.myImage.enabled = false;
                    }

                    currentSlot.myItem = null;
                    currentSlot.ShowUI();
                }

                //adding the new inventory
                for (int i = 0; i < inventorySize; i++)
                {
                    if (inventoryData.itemIDs[i] > 0)
                    {
                        inventory.AddItemSpecific(database.GetItemById(inventoryData.itemIDs[i]), inventoryData.itemAMTs[i], i);
                    }
                }
            }


            //handles loading for playerState
            if (saveType == "player.txt")
            {
                JsonUtility.FromJsonOverwrite((string)bf.Deserialize(file), playerStateData);
                playerObject.transform.position = playerStateData.playerPos;
                playerObject.transform.rotation = playerStateData.playerRot;

                //Destroy(playerObject);
                //playerObject = Instantiate(newPlayerObject, playerStateData.playerPos, playerStateData.playerRot);
            }

            toolBelt.DragAndDropCheck();
            file.Close();

            loadMenu.SetActive(false);
            pauseMenu.pauseMenu.SetActive(false);
            PauseMenu.isPaused = false;
            pauseMenu.UnpauseGame();

            //set pickupPrompt to active
            harvest = GameObject.FindObjectOfType <Harvest>();
            harvest.pickUpPrompt.SetActive(true);

            //set up player FPS Arms animator
            weaponChange.GetAnimatorComponent();
        }
    }