public MyListItem(FlowLayoutPanel area, bool isArea) { ItemKind = isArea; userAreaPanel = area; Tb = new MyListItemTextBox(userAreaPanel, lbl, isArea); tb.ForeColor = Color.FromArgb(204, 202, 204); tb.Text = "New List"; if (isArea) { tb.Text = "New Area"; } this.Size = new Size(167, 18); this.Margin = new Padding(0, 1, 0, 0); this.BackColor = listHoverColor; if (!isArea) { pic.Image = Properties.Resources.circle; pic.Size = new Size(12, 12); lbl.Font = new Font("Corbel", 9.75f); Tb.Font = new Font("Corbel", 9.75f); } else { pic.Size = new Size(12, 13); pic.Image = Properties.Resources.area; lbl.Font = new Font("Corbel", 9.75f, FontStyle.Bold); } pic.SizeMode = PictureBoxSizeMode.StretchImage; pic.Location = new Point(3, 3); lbl.Location = new Point(19, 2); lbl.Size = new Size(130, 17); lbl.DoubleClick += textBoxDoubleClick; this.Controls.Add(pic); this.Controls.Add(lbl); this.Controls.Add(Tb); this.Click += (s, e) => MyInteraction.listClick(this); foreach (Control childControl in this.Controls) { childControl.Click += (s, e) => MyInteraction.listClick(((Control)s).Parent); } if (!isArea) { MyAnimation.SetListBtnColor(this); } else { this.Click += (s, e) => addAllList(this); } lbl.Visible = false; }
private void MyAnimation() { if (!mAnimatedDown) { //up MyAnimation anim = new MyAnimation(mContainerListView, mContainerListView.Height - mDesign.Height); anim.Duration = 500; mContainerListView.StartAnimation(anim); anim.AnimationStart += Anim_AnimationStartDown; anim.AnimationEnd += Anim_AnimationEndDown; mContainerListView.Animate().TranslationYBy(mDesign.Height).SetDuration(500).Start(); } else { //down MyAnimation anim = new MyAnimation(mContainerListView, mContainerListView.Height + mDesign.Height); anim.Duration = 500; mContainerListView.StartAnimation(anim); anim.AnimationStart += Anim_AnimationStartUp; anim.AnimationEnd += Anim_AnimationEndUp; mContainerListView.Animate().TranslationYBy(-mDesign.Height).SetDuration(500).Start(); } mAnimatedDown = !mAnimatedDown; }
public void OnInit(MyAnimation myanim) { this.anim = myanim; this.mesh = new Mesh(); ResetAnimateVariable("", false); //mesh关联 gameObject.GetComponent <MeshFilter>().sharedMesh = this.mesh; //根据图片名字加载使用的材质 gameObject.GetComponent <MeshRenderer>().sharedMaterial = SpriteFrameCache.getInstance().getSpriteTexture(anim.pictName); }
//bool lastOne; public MyTodoItem(string text = null, Image state = null, int _id = -1) { id = _id; Due = MainForm.Data.initDate; Size = new Size(392, 24); Margin = new Padding(18, 0, 3, 0); this.ContextMenuStrip = itemMenu; this.GotFocus += TodoText_GotFocus; MyAnimation.SetListItemColor(this); /* editBtn = new PictureBox(); * editBtn.Size = new Size(18, 12); * editBtn.Location = new Point(2, 6); * editBtn.Image = Properties.Resources.editbtn;*/ CheckBox = new PictureBox(); CheckBox.Size = new Size(12, 13); if (state != null) { CheckBox.Image = state; } else { CheckBox.Image = MyImage.checkbox; } CheckBox.Location = new Point(4, 6); CheckBox.Click += CheckBox_Click; TodoText = new MyAutoSizeTextbox(); TodoText.Location = new Point(24, 4); TodoText.Font = new Font("微软雅黑", 9f); if (text != null) { TodoText.Text = text; } else { TodoText.Text = "New To-Do"; } if (TodoText.Text == "New To-Do") { TodoText.ForeColor = Color.FromArgb(204, 202, 204); } TodoText.KeyPress += TodoText_KeyPress; TodoText.KeyDown += TodoText_KeyDown; TodoText.GotFocus += TodoText_GotFocus; TodoText.LostFocus += TodoText_LostFocus; Content = TodoText.Text; Cstate = CheckBox.Image; this.Controls.Add(CheckBox); this.Controls.Add(TodoText); }
public override void OnInspectorGUI() { DrawDefaultInspector(); Separator(BigSeparator); frameAnimation = (FrameAnimation)target; // add action EditorGUILayout.BeginHorizontal(); GUILayout.Label("新建动画"); newAnimName = GUILayout.TextField(newAnimName); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); bool addAnim1 = GUILayout.Button("新建一阶段动画"); bool addAnim3 = GUILayout.Button("新建三阶段动画"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("保存")) { Save(); } if (GUILayout.Button("读取")) { Load(); } EditorGUILayout.EndHorizontal(); if ((addAnim1 || addAnim3) && !frameAnimation.HasAnim(newAnimName)) { MyAnimation anim = new MyAnimation(); anim.name = newAnimName; anim.oneStage = addAnim1; frameAnimation.animations.Add(anim); } Separator(BigSeparator); DoRemoveAction(); // del action //DoRemoveAction(); for (int i = 0; i < frameAnimation.animations.Count; ++i) { MyAnimation anim = frameAnimation.animations[i]; DrawAnim(anim); } }
//创建一个不包含动作的动画 public void addAnimation(MeshAnimation animation, string name) { if (_animations.ContainsKey(name)) { MyAnimation anim = _animations[name]; anim.AddAnimation(animation); } else { MyAnimation anim = new MyAnimation(); anim.AddAnimation(animation); _animations.Add(name, anim); } }
public void OnInit(string animName = "") { if (animName == null || animName == "") { return; } this.animName = animName; this.anim = AnimationCache.getInstance().getAnimation(this.animName); this.mesh = new Mesh(); ResetAnimateVariable("", false); //mesh关联 gameObject.GetComponent <MeshFilter>().sharedMesh = this.mesh; //根据图片名字加载使用的材质 gameObject.GetComponent <MeshRenderer>().material = SpriteFrameCache.getInstance().getSpriteTexture(anim.pictName); }
//创建一个包含多个动作的动画 public void addAnimation(MeshAnimation animation, string name, string actionName) { //若该生物已创建,则只需要在对应动作增加 if (_animations.ContainsKey(name)) { MyAnimation anim = _animations[name]; anim.AddAnimation(animation, actionName); } //若该生物未创建,创建该生物,并增加对应动作 else { MyAnimation anim = new MyAnimation(); anim.AddAnimation(animation, actionName); _animations.Add(name, anim); } }
public void ProcessAnimation(MyAnimation animation) { animationType = animation.animationType; if (animationType == MyAnimationType.PositionAnim) { body = animation.body; finishPoint = animation.finishPoint.position; } else if (animationType == MyAnimationType.ColorAnim) { image = animation.image; finishColor = animation.finishColor; } speedOfAnimation = animation.speedOfAnimation; accuracy = animation.accuracy; canAnimate = true; }
static private void DisplayList(string title, bool isArea = false) { MyContentPanel toDisplay; if (MainForm.Data.contPanels.ContainsKey(title)) { toDisplay = MainForm.Data.contPanels[title]; toDisplay.updateData(); // MainForm.mainform.Controls.Remove(Data.contPanels[title]); // Data.contPanels[title] = toDisplay; } else { toDisplay = GetDisplayList(title, isArea); MainForm.Data.contPanels.Add(title, toDisplay); MyAnimation.AddMouseDownEvent(toDisplay); MainForm.mainform.Controls.Add(toDisplay); } toDisplay.BringToFront(); MainForm.Data.nowDisplayList = toDisplay; }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.search: //search icon has been clicked. if (mAnimating) { return(true); } if (!mAnimateDown) { //ListView is Up MyAnimation anim = new MyAnimation(mListView, mListView.Height - mSearch.Height); anim.Duration = 500; mListView.StartAnimation(anim); anim.AnimationStart += Anim_AnimationStartDown; anim.AnimationEnd += Anim_AnimationEndDown; mContainer.Animate().TranslationYBy(mSearch.Height).SetDuration(500).Start(); } else { //ListView is Down MyAnimation anim = new MyAnimation(mListView, mListView.Height + mSearch.Height); anim.Duration = 500; mListView.StartAnimation(anim); anim.AnimationStart += Anim_AnimationStartUp; anim.AnimationEnd += Anim_AnimationEndUp; mContainer.Animate().TranslationYBy(-mSearch.Height).SetDuration(500).Start(); } mAnimateDown = !mAnimateDown; return(true); default: return(base.OnOptionsItemSelected(item)); } }
// Use this for initialization void Start() { charNum = playerNums++; moveDirection = transform.TransformDirection(Vector3.forward); xAxis = "Y" + charNum; yAxis = "X" + charNum; lxAxis = "LX" + charNum; lyAxis = "LY" + charNum; RTAxis = "RT" + charNum; LTAxis = "LT" + charNum; if(walkTextures == null) //Assuming they all happen at once { walkTextures = new Texture2D[3]; walkTextures[0] = Resources.Load("Animations/PlayerWalk/necro_walk_1") as Texture2D; walkTextures[1] = Resources.Load("Animations/PlayerWalk/necro_walk_2") as Texture2D; walkTextures[2] = Resources.Load("Animations/PlayerWalk/necro_walk_3") as Texture2D; castTextures = new Texture2D[4]; castTextures[0] = Resources.Load("Animations/PlayerWalk/necro_cast_1") as Texture2D; castTextures[1] = Resources.Load("Animations/PlayerWalk/necro_cast_2") as Texture2D; castTextures[2] = Resources.Load("Animations/PlayerWalk/necro_cast_3") as Texture2D; idleTextures = new Texture2D[1]; idleTextures[0] = Resources.Load("Animations/PlayerIdle/necro_idle_1") as Texture2D; } walkAnim = new MyAnimation(this.renderer, walkTextures, Constants.playerAnimSpeed); idleAnim = new MyAnimation(this.renderer, idleTextures, Constants.playerAnimSpeed); castAnim = new MyAnimation(this.renderer, castTextures, Constants.playerAnimSpeed); wind = Resources.Load("Prefabs/Wind") as GameObject; windPos = (wind.transform.localScale.z + this.transform.localScale.z)*0.5f; curAnim = idleAnim; curAnim.Play(); }
private async void Button_Fav_Clicked(object sender, EventArgs e) { var button = sender as Button; await MyAnimation.Animation1(button); }
public MainForm() { mainform = this; InitializeComponent(); lastFocus = this; #region Basic Activated += MainForm_Activated; Deactivate += MainForm_Deactivate; foreach (var control in new[] { MinimizeLabel, CloseLabel }) { control.MouseEnter += (s, e) => SetLabelColors((Control)s, MouseState.Hover); control.MouseLeave += (s, e) => SetLabelColors((Control)s, MouseState.Normal); control.MouseDown += (s, e) => SetLabelColors((Control)s, MouseState.Down); } TopLeftCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTTOPLEFT); TopRightCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTTOPRIGHT); BottomLeftCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTBOTTOMLEFT); BottomRightCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTBOTTOMRIGHT); TopBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTTOP); LeftBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTLEFT); RightBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTRIGHT); BottomBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTBOTTOM); //SystemLabel.MouseDown += SystemLabel_MouseDown; //SystemLabel.MouseUp += SystemLabel_MouseUp; TitleLabel.MouseDown += TitleLabel_MouseDown; //TitleLabel.MouseUp += (s, e) => { if (e.Button == MouseButtons.Right && TitleLabel.ClientRectangle.Contains(e.Location)) ShowSystemMenu(MouseButtons); }; //TitleLabel.Text = Text; TextChanged += (s, e) => TitleLabel.Text = Text; var marlett = new Font("Marlett", 8.5f); MinimizeLabel.Font = marlett; //MaximizeLabel.Font = marlett; CloseLabel.Font = marlett; //SystemLabel.Font = marlett; MinimizeLabel.MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) { WindowState = FormWindowState.Minimized; } }; //MaximizeLabel.MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) ToggleMaximize(); }; previousWindowState = MinMaxState; SizeChanged += MainForm_SizeChanged; CloseLabel.MouseClick += (s, e) => Close(e); #endregion foreach (var control in new[] { panel2, panel3, panel4, panel5, panel6, panel7, panel8 }) { MyAnimation.SetListBtnColor(control); control.Click += (s, e) => MyInteraction.listClick((Control)s); foreach (Control childControl in control.Controls) { childControl.Click += (s, e) => MyInteraction.listClick(((Control)s).Parent); } } MyAnimation.AddMouseDownEvent(this); MyAnimation.SetListBtnColor(panel12); MyAnimation.SetbuttomBarBtnColor(panel28); AddNewItemBtn.Click += AddNewItemBtn_Click; panel28.Click += AddNewItemBtn_Click; MyAnimation.SetbuttomBarBtnColor(panel31); editBtn.Click += EditBtn_Click; panel31.Click += EditBtn_Click; //MyInteraction.listClick(panel2); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.search: mSearch.Visibility = ViewStates.Visible;; if (mIsAnimating) { return(true); } if (!mAnimatedDown) { //Listview is up MyAnimation anim = new MyAnimation(mListView, mListView.Height - mSearch.Height); anim.Duration = 200; mListView.StartAnimation(anim); anim.AnimationStart += anim_AnimationStartDown; anim.AnimationEnd += anim_AnimationEndDown; mContainer.Animate().TranslationYBy(mSearch.Height).SetDuration(200).Start(); } else { //Listview is down MyAnimation anim = new MyAnimation(mListView, mListView.Height + mSearch.Height); anim.Duration = 200; mListView.StartAnimation(anim); anim.AnimationStart += anim_AnimationStartUp; anim.AnimationEnd += anim_AnimationEndUp; mContainer.Animate().TranslationYBy(-mSearch.Height).SetDuration(200).Start(); } mAnimatedDown = !mAnimatedDown; return(true); case Resource.Id.newAccount: this.StartActivity(new Intent(this, typeof(CreateAccount))); Finish(); return(true); case Resource.Id.newPasswordAction: var intent = new Intent(this, typeof(MainActivity)); intent.PutExtra("mode", (int)Mode.ChangeMasterPassword); this.StartActivity(intent); Finish(); return(true); case Resource.Id.exportToExcel: var result = _fileService.ExportToExcel(); var message = result ? "json файл создан" : "Ошибка при создании файла"; Toast.MakeText(this, message, ToastLength.Short).Show(); return(true); case Resource.Id.importFromExcel: Intent intents = new Intent(Intent.ActionOpenDocument); intents.AddCategory(Intent.CategoryOpenable); intents.SetType("*/*"); StartActivityForResult(intents, 1); return(true); default: return(base.OnOptionsItemSelected(item)); } }
private static void CreateAnimation(Color targetColor) { currentAnimation = ScreenFaderAnimation.CreateScreenFaderAnimation(screenFader.transform.GetChild(0).gameObject, Color.clear, targetColor, 2.0F); currentAnimation.FinishedAnimating += FinishedFadeHandler; }
void DrawAnim(MyAnimation anim) { if (!animFoldMap.ContainsKey(anim.name)) { animFoldMap[anim.name] = false; } EditorGUILayout.BeginHorizontal(); animFoldMap[anim.name] = EditorGUILayout.Foldout(animFoldMap[anim.name], "Anim: " + anim.name); if (GUILayout.Button("播放")) { frameAnimation.UpdateAnimRuntimeData(anim); frameAnimation.Play(anim.name, null, true); } if (GUILayout.Button("删除")) { RemoveAnim(anim.name); } EditorGUILayout.EndHorizontal(); if (!animFoldMap[anim.name]) { return; } EditorGUILayout.BeginHorizontal(); GUILayout.Label("loop"); anim.loop = EditorGUILayout.Toggle(anim.loop); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("sprite path"); anim.spritePath = EditorGUILayout.TextField(anim.spritePath != null ? anim.spritePath : ""); EditorGUILayout.EndHorizontal(); if (anim.oneStage) { EditorGUILayout.BeginHorizontal(); GUILayout.Label("sprite start index"); anim.spriteStart = EditorGUILayout.IntField(anim.spriteStart); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("sprite number"); anim.spriteNum = EditorGUILayout.IntField(anim.spriteNum); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("totle frame number"); int frameLenthBk = anim.frameLenth; anim.frameLenth = EditorGUILayout.IntField(anim.frameLenth); if (frameLenthBk != anim.frameLenth) { anim.framePerSprite = FrameDistribution(anim.spriteNum, anim.frameLenth); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("frame per sprite"); string framePerSpriteBk = anim.framePerSprite; anim.framePerSprite = EditorGUILayout.TextField(anim.framePerSprite); if (framePerSpriteBk != anim.framePerSprite) { anim.frameLenth = FrameSum(anim.framePerSprite); } EditorGUILayout.EndHorizontal(); } else { anim.stageData[0] = EditorGUILayout.Vector3IntField("第一阶段", anim.stageData[0]); anim.stageData[1] = EditorGUILayout.Vector3IntField("第一阶段", anim.stageData[1]); anim.stageData[2] = EditorGUILayout.Vector3IntField("第一阶段", anim.stageData[2]); } }
// Update is called once per frame void Update() { float tempx = Mathf.Clamp(this.transform.position.x, Board.left, Board.right); float tempy = this.transform.position.y; float tempz = Mathf.Clamp(this.transform.position.z, Board.bottom, Board.top); Vector3 temp = new Vector3(tempx, tempy, tempz); this.transform.position = temp; if (!isControllable) { // kill all inputs if not controllable. Input.ResetInputAxes(); } Vector3 forward = -Vector3.forward; Vector3 right = Vector3.right; float iy = Input.GetAxisRaw(xAxis); float ix = Input.GetAxisRaw(yAxis); float ilx = Input.GetAxisRaw(lxAxis); float ily = Input.GetAxisRaw(lyAxis); float LT = Input.GetAxisRaw(LTAxis); float RT = Input.GetAxisRaw(RTAxis); // Target direction relative to the camera Vector3 TarMoveDir = ix * right + iy * forward; Vector3 TarLookDir = ilx * right + ily * forward; moveDirection = TarMoveDir.normalized; if(TarMoveDir != Vector3.zero) { curAnim.Pause(); curAnim = walkAnim; curAnim.Play(); } else { curAnim.Pause(); curAnim = idleAnim; curAnim.Play(); } if( TarLookDir != Vector3.zero ) { lookDirection = Vector3.RotateTowards(lookDirection, TarLookDir, Constants.rotateSpeed * Mathf.Deg2Rad * Time.deltaTime, 1000); lookDirection = lookDirection.normalized; } // Calculate actual motion movement.Set(0.0f,0.0f,0.0f); //movement = transform.TransformDirection(moveDirection); movement = moveDirection; movement *= Constants.moveSpeed; movement *= Time.deltaTime; transform.Translate(movement, Space.World); transform.rotation = Quaternion.LookRotation(lookDirection); if((LT > 0.5) && (windCoolTime <= 0)) { GameObject go = Instantiate(wind, this.transform.position + lookDirection*windPos, transform.rotation) as GameObject; Wind wnd = go.GetComponent<Wind>(); wnd.SetSpawner(this.collider); windCoolTime += Constants.playerWindCooldown; } else if (windCoolTime > 0) { windCoolTime -= Time.deltaTime; } curAnim.Update(); }
private void StartAnimation(MyAnimation animation) { animation.FinishedAnimating += new AnimationEventHandler(AnimationFinished); animation.StartAnimating(); }