void NotifyTrash() { GameObject trashRange = mLauncherController.trashRange; TrashController trashListener = trashRange.GetComponent <TrashController> (); trashListener.OnIconDrag(); }
public TrashService(TrashType trashType, TrashController controller) { ItemType = trashType; _trashController = controller; AnimationService.OnAnimationDestroyEndEvent += DestroyObject; AnimationService.OnAnimationStateChangeEvent += SetAnimationPlaying; }
private void pictureBoxTrash_Click(object sender, EventArgs e) { for (int i = 0; i < flpNote.Controls.Count; i++) { if (flpNote.Controls[i].BackColor == Color.LightGray) { Trash trash = new Trash(); Note note = NoteController.GetNote(i); trash.ID = TrashController.GetListTrash().Count; trash.description = note.description; trash.dateCreated = note.dateCreated; trash.tags = note.tags; trash.isPinned = note.isPinned; TrashController.AddTrash(trash); NoteController.RemoveNote(note); NoteController.RefreshNote(); flpNote.Controls.Remove(flpNote.Controls[i]); this.richTextBoxDescription.Text = ""; break; } } for (int i = this.flpTags.Controls.Count - 1; i >= 0; i--) { Control c = this.flpTags.Controls[i]; if (c.GetType() != typeof(TextBox)) { this.flpTags.Controls.RemoveAt(i); } } }
void Start() { trashController = GameObject.FindWithTag("TrashController").GetComponent <TrashController> (); life = maxLife; isAlive = true; this.audioSource = this.GetComponent <AudioSource> (); }
private void btnRestoreTrash_Click(object sender, EventArgs e) { for (int i = 0; i < flpTrash.Controls.Count; i++) { if (flpTrash.Controls[i].BackColor == Color.LightGray) { TrashController.RefreshTrash(); Trash trash = TrashController.GetTrash(i); Note note = new Note(); note.ID = NoteController.GetListNote().Count; note.description = trash.description; note.dateCreated = trash.dateCreated; note.tags = trash.tags; note.isPinned = trash.isPinned; TrashController.DeleteForever(trash); TrashController.RefreshTrash(); NoteController.AddNote(note); flpTrash.Controls.Remove(flpTrash.Controls[i]); this.richTextBoxTrashDescription.Text = ""; } } }
public void OnPointerDown(PointerEventData eventdata) { if (!_isAnimationPlaying) { s_selectedController = _trashController; } }
public void OnPointerEnter(PointerEventData eventData) { if (IsAbleToSwap() && !_isAnimationPlaying) { Swap(s_selectedController); s_selectedController = null; } }
public void InitTest() { TrashController target = new TrashController(); // TODO: Initialize to an appropriate value int MyAppId = 11; // TODO: Initialize to an appropriate value target.Init(MyAppId); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void HitEmpty(TrashController trashController) { var sequence = DOTween.Sequence(); sequence.Append(trashBodyRenderer.DOColor(config.EmptyHitColor, config.EmptyHitDuration / 2f)); sequence.Join(trashTopRenderer.DOColor(config.EmptyHitColor, config.EmptyHitDuration / 2f)); sequence.Append(trashBodyRenderer.DOColor(trashDefaultColor, config.EmptyHitDuration / 2f)); sequence.Join(trashTopRenderer.DOColor(trashDefaultColor, config.EmptyHitDuration / 2f)); sequence.Play(); }
public void Init() { _ctrl = new TrashController(new FakeTrashRepository()); var config = new HttpConfiguration(); var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/be/api"); var route = config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}"); var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "trash" } }); _ctrl.ControllerContext = new HttpControllerContext(config, routeData, request); _ctrl.Request = request; _ctrl.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config; }
private void textBoxTrashNoteSearch_TextChanged(object sender, EventArgs e) { var searchText = this.textBoxTrashNoteSearch.Text.Split(' '); for (int i = 0; i < TrashController.GetListTrash().Count; i++) { bool isVisible = true; foreach (var text in searchText) { if (!text.Contains("tag:")) { if (!TrashController.GetListTrash()[i].description.Contains(text)) { isVisible = false; } } else { var t = text.Remove(0, ("tag:").Length); bool isContain = false; var tags = TrashController.GetListTrash()[i].tags.Split(' '); foreach (var tag in tags) { if (tag == t) { isContain = true; } } if (!isContain) { isVisible = false; } /*if (!NoteController.GetListNote()[i].tags.Contains(t)) * isVisible = false;*/ } } if (!isVisible) { this.flpTrash.Controls[i].Hide(); } else { this.flpTrash.Controls[i].Show(); } } }
private void btnDeleteTrash_Click(object sender, EventArgs e) { for (int i = 0; i < this.flpTrash.Controls.Count; i++) { if (this.flpTrash.Controls[i].BackColor == Color.LightGray) { TrashController.RefreshTrash(); Trash trash = TrashController.GetTrash(i); TrashController.DeleteForever(trash); flpTrash.Controls.Remove(flpTrash.Controls[i]); } } this.richTextBoxTrashDescription.Text = ""; }
public void Hit(TrashController trashController, PartData partData) { damage++; if (damage < config.DamagedImages.Length) { trashBodyRenderer.sprite = config.DamagedImages[damage]; } var sequence = DOTween.Sequence(); sequence.Append(trashBodyRenderer.DOColor(config.EmptyHitColor, config.HitDuration / 2f)); sequence.Join(trashTopRenderer.DOColor(config.EmptyHitColor, config.HitDuration / 2f)); sequence.Append(trashBodyRenderer.DOColor(trashDefaultColor, config.HitDuration / 2f)); sequence.Join(trashTopRenderer.DOColor(trashDefaultColor, config.HitDuration / 2f)); if (damage < config.DamagedTopRotations.Length) { temp.x = 0f; temp.y = 0f; temp.z = config.DamagedTopRotations[damage]; sequence.Insert(0f, trashTopRenderer.transform.DORotate( temp, config.EmptyHitDuration).SetEase(Ease.InOutBounce)); } if (damage < config.DamagedTopPositions.Length) { temp.x = config.DamagedTopPositions[damage].x; temp.y = config.DamagedTopPositions[damage].y; temp.z = trashTopRenderer.transform.localPosition.z; sequence.Insert(0f, trashTopRenderer.transform.DOLocalMove( temp, config.EmptyHitDuration).SetEase(Ease.InBounce)); } sequence.Play(); if (OnHit != null) { OnHit(this, partData); } }
private void frmTrash_Load(object sender, EventArgs e) { if (this.richTextBoxTrashDescription.ReadOnly == true) { this.richTextBoxTrashDescription.BackColor = Color.White; } foreach (Trash trash in TrashController.GetListTrash()) { Button btn = new Button(); btn.Dock = DockStyle.Top; btn.Width = 340; btn.Height = 50; btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderSize = 0; btn.TextAlign = ContentAlignment.MiddleLeft; btn.Font = new Font("Open Sans", 12, FontStyle.Regular); btn.Padding = new Padding(10, 0, 0, 0); btn.Text = trash.description; btn.Click += Btn_Click; CheckBox checkbox = new CheckBox(); if (trash.isPinned == true) { checkbox.Checked = true; } checkbox.Text = ""; checkbox.AutoSize = true; checkbox.Dock = DockStyle.Left; checkbox.Enabled = false; btn.Controls.Add(checkbox); this.flpTrash.Controls.Add(btn); if (checkbox.Checked) { TrashController.MoveToFirst(trash.ID); this.flpTrash.Controls.SetChildIndex(checkbox.Parent, 0); } } }
private void HandleBlockSpawned(BlockView blockView, BlockData data) { var trashViews = blockView.GetComponentsInChildren <TrashView>(); foreach (var trashView in trashViews) { var trashController = new TrashController(modelController, trashConfig) { Position = trashView.transform.position }; trashes[trashView] = trashController; trashController.OnEmptyHit += trashView.HitEmpty; trashController.OnHit += trashView.Hit; trashController.OnHit += HandleTrashHit; trashView.OnHit += HandleTrashViewHit; } }
public void OnLongClick(PointerEventData lastEventData) { mLauncherController.Log(TAG, "OnLongClick: lastEventData.position=" + lastEventData.position); DestroySelectedBackground(); RectTransform rt = gameObject.GetComponent <RectTransform> (); float posZ = LauncherController.ICON_RISING_DISTANCE; mLauncherController.Log(TAG, "OnLongClick: AnchorPos3D=" + rt.anchoredPosition3D); Vector3 toPos = new Vector3(rt.anchoredPosition3D.x, rt.anchoredPosition3D.y, posZ); Tweener tw = rt.DOAnchorPos3D(toPos, LauncherController.ANIM_DURATION); tw.OnComplete(test); dragMe = gameObject.AddComponent <DragMe> (); dragMe.mLauncherController = mLauncherController; dragMe.launcherModel = mLauncherController.launcherModel; dragMe.OnPointerDown(lastEventData); TrashController trashController = mLauncherController.trashRange.GetComponent <TrashController> (); trashController.Rise(); }
// Use this for initialization void Start() { isAngry = false; timeIsSet = false; clock = GameObject.FindGameObjectWithTag("Timer"); timer = clock.GetComponent <TimeManager>(); can = GameObject.Find("Trash Can"); trashcan = can.GetComponent <TrashController>(); laundrybin = GameObject.Find("Laundry"); laundry = laundrybin.GetComponent <LaundryController>(); momAnim = transform.GetChild(0).gameObject.GetComponent <Animator>(); doorCollider = gameObject.GetComponent <BoxCollider2D> (); anim = GetComponent <Animator>(); momAudio = GetComponent <AudioSource> (); intervalMax = (int)(timer.length / momMinVisits - 1); //This is based on the level length in TimeManager knocking = false; penaltyApplied = false; momIsHere = false; }
// OCCURS BEFORE INITIALIZATION void Awake() { // CHECKS IF THERE ARE OTHER INSTANCES OF GAMECONTROLLER if (instance == null) { instance = this; } //DESTROYS ITSELF IF ANOTHER INSTANCE EXISTS else if (instance != null) { Destroy(this); } trash = GameObject.Find("Trash Can").GetComponent <TrashController>(); laundry = GameObject.Find("Laundry").GetComponent <LaundryController>(); mother = GameObject.Find("Door").GetComponent <Mother>(); hw = GameObject.Find("HomeworkInterface").GetComponent <HomeworkInterface> (); window = GameObject.Find("Window").GetComponent <WindowController> (); timeManager = GameObject.Find("TimeManager").GetComponent <TimeManager> (); bed = GameObject.Find("Bed").GetComponent <BedController> (); bedtimeFilter = GameObject.Find("Bedtime Filter").GetComponent <BedtimeFilterController> (); setDayStats(); }
private InHand Interact() { Ray lookAt = new Ray(transform.position, transform.forward); Debug.DrawRay(lookAt.origin, 15 * lookAt.direction, Color.red, 5); RaycastHit info; //the Array only works if it is in the range of 'raycastRange' if (Physics.Raycast(lookAt, out info, raycastRange)) { BarellController barrell = info.collider.GetComponent <BarellController>(); if (barrell)//if it has the script 'PlantsController' do this { if (currently_Holding == InHand.Empty) { BarellController.PlantType pickingUP = barrell.pickUp(); switch (pickingUP) { case BarellController.PlantType.Carrot: return(InHand.Carrot_Seeds); case BarellController.PlantType.Tomatoe: return(InHand.Tomatoe_Seeds); } } } plotControl plot = info.collider.GetComponent <plotControl>(); if (plot) { //Seed planting if (currently_Holding == InHand.Carrot_Seeds || currently_Holding == InHand.Tomatoe_Seeds) { if (plot.plotIs == plotControl.PlotState.Soil) { plot.InteractP2(currently_Holding); return(InHand.Empty); } } //plucker for removing the rubbish (grass) if (currently_Holding == InHand.Plucker) { if (plot.plotIs == plotControl.PlotState.Rubbish) { plot.InteractP2(currently_Holding); return(InHand.Plucker); } } //Once the plant is grown (tomato) if (currently_Holding == InHand.Empty) { if (plot.plotIs == plotControl.PlotState.Tomatoe_Plant) { plot.InteractP2(currently_Holding); return(InHand.Tomatoes); } } //Once the plant is grown (carrots) (so that the player could pick up the item) if (currently_Holding == InHand.Empty) { if (plot.plotIs == plotControl.PlotState.Carrot_Plant) { plot.InteractP2(currently_Holding); return(InHand.Carrots); } } } TrashController trash = info.collider.GetComponent <TrashController>(); if (trash) { return(InHand.Empty); } PluckerControl plucker = info.collider.GetComponent <PluckerControl>(); if (plucker) { if (currently_Holding == InHand.Empty) { return(InHand.Plucker); } } TableController table = info.collider.GetComponent <TableController>(); if (table) { if (currently_Holding == InHand.Empty) { if (table.SomethingOnTable()) { GameObject item = table.removeTopItem(); //add the script to the tomato and carrots prefab and add it to the table, + delete an extra table VegControl newplant = item.GetComponent <VegControl>(); if (newplant) { switch (newplant.thisIsA) { case VegControl.VegType.Carrot: return(InHand.Carrots); case VegControl.VegType.Tomatoe: return(InHand.Tomatoes); } } } } else { if (currently_Holding == InHand.Carrots) { table.putCarrotOn(); return(InHand.Empty); } if (currently_Holding == InHand.Tomatoes) { table.putTomatoOn(); return(InHand.Empty); } } } P2WagonController wagon = info.collider.GetComponent <P2WagonController>(); if (wagon) { if (currently_Holding == InHand.Carrots) { wagon.putCarrotOn(); return(InHand.Empty); } if (currently_Holding == InHand.Tomatoes) { wagon.putTomatoOn(); return(InHand.Empty); } } PlayerController playerHit = info.collider.GetComponent <PlayerController>(); if (playerHit) { GameObject player1; if (currently_Holding == InHand.Plucker) { if (player1 = GameObject.FindWithTag("Player1")) { player1.transform.position = new Vector3(playerHit.transform.position.x, transform.position.y + 7, transform.position.z); } } } } return(currently_Holding); }
public void OnPointerUp(PointerEventData eventData) { TrashController trashController = mLauncherController.trashRange.GetComponent <TrashController> (); trashController.OnDrop(eventData); }
private void HandleTrashHit(TrashController trashController, PartData partData) { playerController.Hit(trashController.Position); }
public TrashView(TrashType type, TrashController controller) { _sprite = Resources.Load <Sprite>("item_" + type.ToString()); _controller = controller; }