public void resetUI() { if (_prepareFood == null) { return; } _isReloading = true; var foodData = FoodManager.getInstance().FoodList[_prepareFood.FoodId]; TextBlockName.Text = foodData.Name; TextBlockTableId.Text = _prepareFood.TableId.ToString(); if (_prepareFood.PrepareStateId >= 0) { ComboBoxState.IsEnabled = true; ComboBoxState.SelectedItem = ComboBoxState.Items[_prepareFood.PrepareStateId]; for (int i = 0; i < ComboBoxState.Items.Count - 1; i++) { if (_prepareFood.PrepareStateId > i) { ((ComboBoxItem)ComboBoxState.Items[i]).Visibility = Visibility.Collapsed; } else { ((ComboBoxItem)ComboBoxState.Items[i]).Visibility = Visibility.Visible; } } } else { ComboBoxState.SelectedItem = ComboBoxState.Items[4]; ComboBoxState.IsEnabled = false; } //ComboBoxState.IsDropDownOpen = true; _isReloading = false; }
private void Start() { inputManager = ClassManager.instance.inputManager; farmerAnimator = ClassManager.instance.farmerAnimator; foodManager = ClassManager.instance.foodManager; shopManager = ClassManager.instance.shopManager; }
void Awake() { //缓存全局的本地食物管理器 localFoodManager = this; PhotonNetwork.OnEventCall += this.OnEventRaised; foodFlushLock = new int[FoodCount]; foodInstances = new GameObject[FoodCount]; //食物AI列表 foodAIInstances = new GameObject[FoodAICount]; //毒物AI列表 poisonCountAll = 0; for (int i = 0; i < poisonCounts.Length; i++) { for (int j = 0; j < poisonCounts[i]; j++) { poisonCountAll++; } } poisonInstances = new GameObject[poisonCountAll]; RaiseEventOptions options = new RaiseEventOptions(); options.Receivers = ReceiverGroup.All; options.CachingOption = EventCaching.DoNotCache; PhotonNetwork.RaiseEvent(1, null, true, options); }
public void checkAndAddFoodIdToComboBox(int foodId) { foreach (ComboBoxItem comboData in ComboBoxSelectFood.ComboBoxData.Items) { if ((int)comboData.Tag == foodId) { return; } } var foodData = FoodManager.getInstance().FoodList[foodId]; string txt = foodData.FoodId + " - " + foodData.Name; var imgSrc = (ImageSource)Application.Current.FindResource("ImageDefaultFood"); if (foodData.ImageId != null) { byte[] imgData = null; ImageManager.getInstance().loadImageFromLocal(foodData.ImageId ?? default(int), out imgData); if (imgData != null) { var img = UtilFuction.ByteToImage(imgData); imgSrc = UtilFuction.imageToBitmapSource(img); } } var item = ComboBoxSelectFood.addItem(txt, imgSrc); item.Tag = foodData.FoodId; }
// Use this for initialization void Start() { workM = gameObject.GetComponent <WorkManager>(); foodM = gameObject.GetComponent <FoodManager>(); att = gameObject.GetComponent <Attributes>(); InvokeRepeating("SpecialBehavior", 180f, 180f); }
// Use this for initialization void Start() { population = FindObjectOfType <PopulationManager>().GetComponent <PopulationManager>(); inventory = GetComponent <PlayerInventory>(); foods = FindObjectOfType <FoodManager>().GetComponent <FoodManager>(); audioManager = FindObjectOfType <AudioManager>().GetComponent <AudioManager>(); }
// Use this for initialization void Start() { if (foodManager == null) { foodManager = GameObject.Find("GameManager").GetComponent <FoodManager>(); } }
//--// public void SetFruitChk(m_eFruit eKind) { if (eKind == m_eFruit.PEANUTS) { for (int i = 0; i < listObjPeanuts.Count; i++) { FoodManager cFoodManager = listObjPeanuts[i].GetComponent <FoodManager>(); if (cFoodManager.m_bEat) { listObjPeanuts[i].SetActive(false); listObjPeanuts[i].transform.position = m_tDummy.position; SetRespawnPoint(i, listObjPeanuts[i], m_eFruit.PEANUTS); StartCoroutine("PeanutRespawn", i); cFoodManager.m_bEat = false; } } } else if (eKind == m_eFruit.GRAPES) { for (int i = 0; i < listObjGrapes.Count; i++) { FoodManager cFoodManager = listObjGrapes[i].GetComponent <FoodManager>(); if (cFoodManager.m_bEat) { listObjGrapes[i].SetActive(false); listObjGrapes[i].transform.position = m_tDummy.position; SetRespawnPoint(i, listObjGrapes[i], m_eFruit.GRAPES); StartCoroutine("GrapeRspawn", i); cFoodManager.m_bEat = false; } } } }
public Order(string _OId, string _FId, string _UId, string date) { OId = _OId; foodOrder = FoodManager.getFood(_FId, "FId"); consumer = UserManager.getUser(_UId, "Id"); postingDate = Convert.ToDateTime(date); }
public FoodListViewModel() { // Since Android tabs appear on top, the repeating title does not make any sense Title = Device.OnPlatform<string>("Food Items", "My Menu (Admin)",""); manager = DependencyService.Get<IAzureDataManager<Food>>() as FoodManager; Device.BeginInvokeOnMainThread(async () => { await manager.SyncAsync(); }); }
public void reloadFoodTableUI(bool isReloadFromServer = false, Action cbAfterReload = null) { if (isReloadFromServer) { RequestManager.getInstance().showLoading(); Action <NetworkResponse> cbSuccessSent = delegate(NetworkResponse networkResponse) { RequestManager.getInstance().hideLoading(); if (!networkResponse.Successful) { WindownsManager.getInstance().showMessageBoxSomeThingWrong(); } else { reloadFoodTableUI(false, cbAfterReload); } }; Action <string> cbError = delegate(string err) { WindownsManager.getInstance().showMessageBoxErrorNetwork(); RequestManager.getInstance().hideLoading(); }; FoodManager.getInstance().getAllFoodFromServerAndUpdate( cbSuccessSent, cbError ); } else { LVFood.Items.Clear(); foreach (KeyValuePair <int, Food> entry in FoodManager.getInstance().FoodList) { if (entry.Value != null) { var foodCell = new FoodCell(entry.Value, this); LVFood.Items.Add(foodCell); var imageId = entry.Value.ImageId ?? default(int); if (entry.Value.ImageId != null && imageId >= 0) { if (ImageManager.getInstance().checkImageExistLocal(imageId)) { ImageManager.getInstance().loadImage(imageId, delegate(byte[] imageData) { foodCell.setImageFood(UtilFuction.ByteToImage(imageData)); }); } else { ImageManager.getInstance().loadImage(imageId, delegate(byte[] imageData) { checkAndSetImageForFoodCell(entry.Value.FoodId, imageId, UtilFuction.ByteToImage(imageData)); }); } } } } cbAfterReload?.Invoke(); } }
public void ResetGame() { Player1 = new SnakePlayer(this); FoodMngr = new FoodManager(GameCanvas.Width, GameCanvas.Height); FoodMngr.AddRandomFood(10); score = 0; }
private void Initialize() { TechTypeHelpers.Initialize(); ARSeaBreezeFCS32Awake_Patcher.AddEventHandlerIfMissing(AlertedNewSeaBreezePlaced); ARSeaBreezeFCS32Destroy_Patcher.AddEventHandlerIfMissing(AlertedSeaBreezeDestroyed); if (FoodManager == null) { FoodManager = gameObject.AddComponent <FoodManager>(); FoodManager.Initialize(this); } if (StorageManager == null) { StorageManager = new SCStorageManager(); StorageManager.Initialize(this); } if (GasManager == null) { GasManager = new GasManager(); GasManager.Initialize(this); } if (PowerManager == null) { PowerManager = new PowerManager(); PowerManager.Initialize(this); StartCoroutine(UpdatePowerState()); } AnimationManager = gameObject.GetComponent <AnimationManager>(); if (DisplayManager == null) { DisplayManager = gameObject.AddComponent <SCDisplayManager>(); } if (ColorManager == null) { ColorManager = gameObject.AddComponent <ColorManager>(); ColorManager.Initialize(gameObject, SeaCookerBuildable.BodyMaterial); } if (AudioManager == null) { AudioManager = new AudioManager(gameObject.GetComponent <FMOD_CustomLoopingEmitter>()); //InvokeRepeating(nameof(UpdateAudio), 0, 1); } if (PlayerInteraction == null) { PlayerInteraction = gameObject.GetComponent <PlayerInteraction>(); } PlayerInteraction.Initialize(this); //FindHabitat(); IsInitialized = true; }
private void Awake() { _foodManager = ServiceLocator.Resolve <FoodManager>(); _gameManager = ServiceLocator.Resolve <GameManager>(); _trigger2D.TriggerEnter += GrabFoodFromTable; AnimationHandTumbler(false); }
private void Awake() { FM = GameObject.FindGameObjectWithTag("Manager").GetComponent <FoodManager>(); targetedFoodLayerChange.Initialize(); RandomizeColor(); hitByProjectileAudioSource = GetComponent <AudioSource>(); }
private void btnAdd_Click(object sender, EventArgs e) { //校验信息完整性 if (CheckInput()) { Foods F = new Foods() { FoodName = txtFoodName.Text, FoodPrice = Convert.ToDecimal(cboFoodPrice.Text), FoodType = (cboFoodType.SelectedIndex + 1).ToString(), FoodTime = TimeSpan.Parse("00:" + nudtxtFoodTime.Text + ":00"), }; int n = FoodManager.InsertFood(F); string pLocalFilePath = file;//要复制的文件路径 string path = Application.StartupPath; int index = path.IndexOf("KaMiFoodSystem"); path = path.Substring(0, index) + "KaMiFoodSystem"; string pSaveFilePath = Application.StartupPath + @"\Images\食物\" + txtFoodName.Text + ".jpg"; //指定存储的路径 string pSaveFilePath2 = path + @"\KaMiFood\KaMiFood\bin\Debug\Images\食物\" + txtFoodName.Text + ".jpg"; //指定存储的路径 File.Copy(pLocalFilePath, pSaveFilePath, true); File.Copy(pLocalFilePath, pSaveFilePath2, true); if (n > 0) { MessageBox.Show("添加成功"); Transmit.FrmFood.dgvFoodInfo.DataSource = FoodManager.SelectFoodAll(); Transmit.FrmFood.dgvFoodInfo.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Transmit.FrmFood.SelectFood(); this.Close(); } } }
public FoodListViewModel() { // Since Android tabs appear on top, the repeating title does not make any sense Title = Device.OnPlatform <string>("Food Items", "My Menu (Admin)", ""); manager = DependencyService.Get <IAzureDataManager <Food> >() as FoodManager; Device.BeginInvokeOnMainThread(async() => { await manager.SyncAsync(); }); }
private void Awake() { if (instance == null) { instance = this; } }
private void init(bool fullRegen = false) { Vector3 min = new Vector3(0, Constants.HUD_OFFSET, 0f); Vector3 max = new Vector3(Constants.RESOLUTION_X, Constants.RESOLUTION_Y, 0f); this.boundary = new BoundingBox(min, max); this.rand = new Random(); PositionGenerator.getInstance().init(this.rand); SpawnGenerator.getInstance().SpawnRequests.Clear(); if (StateManager.getInstance().GameMode == GameMode.OnePlayer) { this.playerOne = new Snake(this.content, Constants.HEADING_UP, 0f, ConfigurationManager.getInstance().PlayerOnesControls); } else { this.playerOne = new Snake(this.content, Constants.HEADING_UP, 100f, ConfigurationManager.getInstance().PlayerOnesControls); this.playerTwo = new Snake(this.content, Constants.HEADING_UP, -100f, ConfigurationManager.getInstance().PlayerTwosControls); } if (fullRegen) { this.backGround = new BackGround(this.content); this.hud = new HUD(this.content); this.foodManager = new FoodManager(content, this.rand); this.portals = new PortalManager(content, this.rand); this.walls = new WallManager(content, this.rand); } #if DEBUG this.debugLine = LoadingUtils.load <Texture2D>(this.content, "Chip"); #endif }
public GameScreen(Game game, SpriteBatch batch, ChangeScreen changeScreen) : base(game, batch, changeScreen, BackButtonScreenType.Gameplay) { dropTimer = 0; lastItemPickup = ""; levelUpMsg = ""; levelUpDisplayed = false; vx = 0; vy = 0; foodVy = 0; friction = 1; distance = 0; levelNum = 1; playerIsMoving = false; playerIsJumping = false; musicIsPlaying = false; foodValueDisplayed = false; foodManager = new FoodManager(content); deathTimer = new Timer(); deathTimer.SetTimer(0, 0, DOOM_TIME);//5 seconds timerStarted = false; gameOver = false; gameOverTimer = new Timer(); gameOverTimer.SetTimer(0, 0, 5); }
//resets game state to default private void Reset() { dropTimer = 0; lastItemPickup = ""; levelUpMsg = ""; lastItemImg = content.Load <Texture2D>(@"Images/none"); vx = 0; vy = 0; foodVy = 0; friction = 1; distance = 0; levelNum = 1; playerIsMoving = false; playerIsJumping = false; foodValueDisplayed = false; levelUpDisplayed = false; timerStarted = false; musicIsPlaying = false; foodManager = new FoodManager(content); foodMeter = new FoodMeter(emptyBarTexture, filledBarTexture, capacityTexture, 120, 420); player = new Player(playerImg, new Vector2(Screen.ScreenWidth / 2, GROUND_HEIGHT)); //foodList.Clear(); //trashCan.Clear(); foodList = new List <Food>(); trashCan = new List <Food>(); gameOver = false; gameOverTimer.SetTimer(0, 0, 5); }
public void Initialize(Sprite foodSprite, Nutrition nutritionFacts, FoodManager fm) { nutrition = nutritionFacts; GetComponent <SpriteRenderer> ().sprite = foodSprite; foodManager = fm; onPlate = false; }
public IActionResult AddConsDate(string username, long bfid, BConsDate bConsDate) { Console.WriteLine(bConsDate.ConsDate); ViewData["username"] = username; UserManager um = new UserManager(); long id = um.getId(username); FoodManager fm = new FoodManager(); int cod = fm.editConsDate(bfid, bConsDate.ConsDate); if (cod == 0) { ViewData["message"] = ""; } else { ViewData["message"] = "Update failed: "; } if (cod == 1) { ViewData["message"] += "Consumption date can not be in the future"; } IEnumerable <BFoodItem> foodItemList = fm.getFoodList(id); return(View("~/Views/MainPage/List.cshtml", foodItemList)); }
private void updateOrCreateFood() { loadingAnim.Visibility = Visibility.Visible; Action <NetworkResponse> cbSuccessSent = delegate(NetworkResponse networkResponse) { if (!networkResponse.Successful) { WindownsManager.getInstance().showMessageBoxSomeThingWrong(); } else { if (_foodTab != null) { _foodTab.reloadFoodTableUI(); } Close(); } loadingAnim.Visibility = Visibility.Hidden; }; Action <string> cbError = delegate(string err) { WindownsManager.getInstance().showMessageBoxErrorNetwork(); loadingAnim.Visibility = Visibility.Hidden; }; var ingredientsWithFood = getIngredientWithFoodListFromTable(); decimal price = 0; Decimal.TryParse(TextBoxPrice.Text, out price); try { if (_foodDetailId != Constant.ID_CREATE_NEW) { FoodManager.getInstance().updateFoodFromServerAndUpdate( _foodDetailId, TextBoxName.Text, ingredientsWithFood, price, Convert.ToInt64(((ComboData)ComboBoxCategory.SelectedItem).Id), _currentImageId, cbSuccessSent, cbError ); } else { FoodManager.getInstance().createFoodFromServerAndUpdate( TextBoxName.Text, ingredientsWithFood, price, Convert.ToInt64(((ComboData)ComboBoxCategory.SelectedItem).Id), _currentImageId, cbSuccessSent, cbError ); } } catch (Exception ex) { } }
public async void OnUpdateClicked() { var user = JsonConvert.DeserializeObject <ApplicationUser>(Preferences.Get("User", "default_value")); RestService restSevice = new RestService(); FoodManager myFoodManager = new FoodManager(restSevice); selectedFood.Details = Details; selectedFood.FoodType = (TypeOfFood)Enum.Parse(typeof(TypeOfFood), (string)FoodType); selectedFood.Name = Name; if (IsImageChanged) { string connectionString = Constants.connectionString; BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString); string containerName = "foodpicsblobs"; BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName); containerClient.CreateIfNotExists(); BlobClient blobClient = containerClient.GetBlobClient(selectedFood.ImageUrl); await blobClient.UploadAsync(new MemoryStream(photo), true); } Response response = await myFoodManager.UpdateFoodAsync(SelectedFood); switch (response.Status) { case Constants.Status.Error: { switch (response.Message) { case Constants.APIMessages.ErrorOnDeletion: { DisplayErrorOnUpdate(); break; } default: { DisplayFatalError(); break; } } } break; case Constants.Status.Success: { DisplayUpdatedFood(); await App.Current.MainPage.Navigation.PushAsync(new MyProfile()); break; } default: { DisplayFatalError(); break; } } }
protected override void Start() { base.Start(); randomizeStartPoint = Random.Range(0, 100); m_foodManager = FindObjectOfType <FoodManager>(); m_driving = FindObjectOfType <Driving>(); }
void Awake() { _instance = this; this.Food = new List <Transform>(); _foodPlane = new Plane(Vector3.up, new Vector3(0, this.FoodHeight, 0)); GlobalEvents.Notifier.Listen(FoodSpawnEvent.NAME, this, onFoodSpawn); GlobalEvents.Notifier.Listen(FoodDestroyedEvent.NAME, this, onFoodDestroyed); }
private void FrmFood_Load(object sender, EventArgs e) { Transmit.FrmFood = this; btnAllFood.BaseColor = Color.SkyBlue; dgvFoodInfo.DataSource = FoodManager.SelectFoodAll(); dgvFoodInfo.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; SelectFood(); }
private void Start() { farmerMovement = ClassManager.instance.farmerMovement; playerInventory = ClassManager.instance.playerInventory; foodManager = ClassManager.instance.foodManager; useItem = ClassManager.instance.useItem; shopManager = ClassManager.instance.shopManager; }
private void Start() { m_dragRigidbody = FindObjectOfType <DragRigidbody>(); m_foodManager = FindObjectOfType <FoodManager>(); audioSource = GetComponent <AudioSource>(); StartCoroutine(LoseFoodOverTime()); }
void Awake() { foodPrefab = Resources.Load <GameObject>("Prefabs/Food"); CreateFood(); _instance = this; }
public void GetFood() { getFoodCount += 1; if (getFoodCount % spawnRewardNumber == 0) { FoodManager.SpawnReward(); } GetScore(foodScore); }
void Awake() { if (Instance != null) { DestroyImmediate(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); }
public SnakeForm() { InitializeComponent(); Application.AddMessageFilter(this); this.FormClosed += (s, e) => Application.RemoveMessageFilter(this); Player1 = new SnakePlayer(this); FoodMngr = new FoodManager(GameCanvas.Width, GameCanvas.Height); FoodMngr.AddRandomFood(10); ScoreTxtBox.Text = score.ToString(); }
public static void Main(string[] args) { FoodManager foodmanager = new FoodManager(); Builder instance; Console.WriteLine("Please Enter Food No:"); string No = Console.ReadLine(); string foodType = System.Configuration.ConfigurationManager.AppSettings["No" + No]; //ConfigurationSettings.AppSettings["No" + No]; instance = (Builder)Assembly.Load("Builder.KFC").CreateInstance("DesignPatterns.Builder.KFC." + foodType); foodmanager.Construct(instance); Food food = instance.GetFood(); food.Show(); Console.ReadLine(); }