public void PerformActivity(int activityNumber) { // check reqs IActivity activity = allActivities[activityNumber]; if (activity.AreRequirementsFulfilled(TutorialSlotManager.instance.GetCurrentReelModels())) { ActivityButton activityButton = activityButtons[activityNumber]; if (activityButton.isActivated) { if (!activityButton.isCompleted) { if (!activityButton.isRepeatable) { activityButtons[activityNumber].SetToComplete(); } activity.PerformActivity(); } } } else { ActivityButton activityButton = activityButtons[activityNumber]; if (!activityButton.isCompleted) { activity.FailActivity(); } } }
private void populateList() { foreach (var item in activityList.activities) { GameObject newButton = Instantiate(activityButton) as GameObject; ActivityButton button = newButton.GetComponent <ActivityButton>(); button.dateText.text = item.startDate.ToString(); button.distanceText.text = item.distance.ToString(); //button.button.onClick.AddListener( ()=>{androidPlugin.showSimpleMessage("This activity occurs on "+item.startDate.ToString());}); newButton.transform.SetParent(contentPanel); } }
public void ShowActivityNotify(InstaActivityCount count) { try { if (ActivityNotifyUc == null) { return; } var pos = ActivityButton.GetPosition(); double x = pos.X + 5; double y = 0; if (AppTitleBar.VerticalAlignment == VerticalAlignment.Top) { y = pos.Y + ActivityButton.ActualHeight - 14; } else { if (!DeviceUtil.IsMobile) { y = pos.Y - ActivityButton.ActualHeight + 18; } else { y = pos.Y - ActivityButton.ActualHeight; } } var transform = new CompositeTransform { TranslateX = x, TranslateY = y }; ActivityNotifyUc.Show(transform, count, AppTitleBar.VerticalAlignment == VerticalAlignment.Bottom); } catch { } }
public MainWindow() { InitializeComponent(); //Cargar Actividades Disponibles Assembly assembly = Assembly.GetEntryAssembly(); Type m_ActivityType = typeof(Activity); foreach (var type in assembly.GetTypes()) { if (m_ActivityType.IsAssignableFrom(type) && (m_ActivityType != type)) { ActivityButton button = new ActivityButton(this, type); ToolStripMenuItem item = new ToolStripMenuItem() { Image = button.Icon, Text = button.Title, Tag = button }; item.Click += item_Click; menuToolStripMenuItem.DropDownItems.Insert(menuToolStripMenuItem.DropDownItems.Count - 2, item); } } }
void ReleaseDesignerOutlets() { if (ActivityButton2 != null) { ActivityButton2.Dispose(); ActivityButton2 = null; } if (ButtonView2 != null) { ButtonView2.Dispose(); ButtonView2 = null; } if (ButtonView1 != null) { ButtonView1.Dispose(); ButtonView1 = null; } if (AdoptedView != null) { AdoptedView.Dispose(); AdoptedView = null; } if (ActivityButton != null) { ActivityButton.Dispose(); ActivityButton = null; } if (AdoptButton != null) { AdoptButton.Dispose(); AdoptButton = null; } if (AgeValueLabel != null) { AgeValueLabel.Dispose(); AgeValueLabel = null; } if (ImageView1 != null) { ImageView1.Dispose(); ImageView1 = null; } if (ImageView2 != null) { ImageView2.Dispose(); ImageView2 = null; } if (ImageView3 != null) { ImageView3.Dispose(); ImageView3 = null; } if (ImageView4 != null) { ImageView4.Dispose(); ImageView4 = null; } if (ImageView5 != null) { ImageView5.Dispose(); ImageView5 = null; } if (ImageView6 != null) { ImageView6.Dispose(); ImageView6 = null; } if (LastSignalLabel != null) { LastSignalLabel.Dispose(); LastSignalLabel = null; } if (MainImageView != null) { MainImageView.Dispose(); MainImageView = null; } if (NameLabel != null) { NameLabel.Dispose(); NameLabel = null; } if (OwnerLabel != null) { OwnerLabel.Dispose(); OwnerLabel = null; } if (PositionLabel != null) { PositionLabel.Dispose(); PositionLabel = null; } if (TypeLabel != null) { TypeLabel.Dispose(); TypeLabel = null; } }
void item_Click(object sender, EventArgs e) { ActivityButton button = (sender as ToolStripMenuItem).Tag as ActivityButton; button.Activate(); }
private void BMouseDown(object sender, MouseButtonEventArgs e) { HideAllPopups(); if (e.RightButton == MouseButtonState.Pressed) { _currentButton = (ActivityButton)sender; ShowActivityButtonContextMenu((ActivityButton)sender); } }
/// <summary> /// Shows the activity button context menu /// </summary> /// <param name="btn">The activity button that is right clicked</param> private void ShowActivityButtonContextMenu(ActivityButton btn) { if(_activityWindow.Visibility == Visibility.Visible) _activityWindow.Hide(); var transform = btn.TransformToAncestor(this); var rootPoint = transform.Transform(new Point(0, 0)); _activityWindow.Show(_proxies[btn.ActivityId].Activity, (int)rootPoint.X); }
/// <summary> /// Converts a button object into an activity proxy /// </summary> /// <param name="b">Button representing an activity</param> /// <returns>A proxy object that represent that activity connected to the button</returns> private Proxy GetProxyFromButton(ActivityButton b) { return _proxies[b.ActivityId]; }
/// <summary> /// Adds an activity button to the activity bar /// </summary> /// <param name="activity">The activity that is represented by the button</param> private void AddActivityUi(Activity activity) { Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() => { var p = new Proxy {Desktop = new VirtualDesktop(), Activity = activity}; VirtualDesktopManager.Desktops.Add(p.Desktop); var b = new ActivityButton(new Uri("pack://application:,,,/Images/activity.PNG"),activity.Name) { RenderMode = RenderMode.Image, ActivityId = p.Activity.Id }; b.AllowDrop = true; b.Drop += BDrop; b.Click += BClick; b.MouseDown += BMouseDown; b.Style = (Style)FindResource("ColorHotTrackButton"); p.Button = b; Body.Children.Add(p.Button); _proxies.Add(p.Activity.Id, p); })); }
protected override void DrawSectionBody() { DemoGuiUtils.DrawRow(() => { GUILayout.Label("Text: ", GSStyles.NormalLabelText); _text = GUILayout.TextField(_text, GSStyles.TextField); }); DemoGuiUtils.DrawRow(() => { GUILayout.Label("Image url: ", GSStyles.NormalLabelText); }); DemoGuiUtils.DrawRow(() => { _imageUrl = GUILayout.TextField(_imageUrl, GSStyles.TextField); }); DemoGuiUtils.DrawRow(() => { GUILayout.Label("Video url: ", GSStyles.NormalLabelText); }); DemoGuiUtils.DrawRow(() => { _videoUrl = GUILayout.TextField(_videoUrl, GSStyles.TextField); }); DemoGuiUtils.DrawRow(() => { _useCustomImage = GUILayout.Toggle(_useCustomImage, "", GSStyles.Toggle); GUILayout.Label("Send Custom Image", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f)); }); DemoGuiUtils.DrawRow(() => { _useCustomVideo = GUILayout.Toggle(_useCustomVideo, "", GSStyles.Toggle); GUILayout.Label("Send Custom Video", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f)); }); DemoGuiUtils.DrawRow(() => GUILayout.Label("Button", GSStyles.NormalLabelText)); DemoGuiUtils.DrawRow(() => { GUILayout.Label("Title: ", GSStyles.NormalLabelText); _title = GUILayout.TextField(_title, GSStyles.TextField); }); GUILayout.Label("Action: " + (_action ?? "Default"), GSStyles.NormalLabelText); DemoGuiUtils.DrawRow(() => { if (GUILayout.Button("Default", GSStyles.ShortButton)) { _action = null; } var actions = new[] { GetSocialActionType.Custom, GetSocialActionType.OpenProfile, GetSocialActionType.OpenActivity, GetSocialActionType.OpenInvites, GetSocialActionType.OpenUrl, GetSocialActionType.AddFriend }; actions.ToList().ForEach(action => { if (GUILayout.Button(action, GSStyles.ShortButton)) { _action = action; } }); }); DemoGuiUtils.DynamicRowFor(_actionData, "Action Data"); DemoGuiUtils.DynamicRowFor(_properties, "Properties"); if (GUILayout.Button("Post", GSStyles.Button)) { var content = new ActivityContent(); content.Text = _text; if (_action != null && _title != null && _title.Length != 0) { var action = GetSocialAction.Create(_action, _actionData.ToDictionary(data => data.Key, data => data.Val)); content.Button = ActivityButton.Create(_title, action); } if (_imageUrl.Length > 0) { content.AddMediaAttachment(MediaAttachment.WithImageUrl(_imageUrl)); } if (_videoUrl.Length > 0) { content.AddMediaAttachment(MediaAttachment.WithVideoUrl(_videoUrl)); } if (_useCustomImage) { content.AddMediaAttachment(MediaAttachment.WithImage(Resources.Load <Texture2D>("activityImage"))); } if (_useCustomVideo) { content.AddMediaAttachment(MediaAttachment.WithVideo(DemoUtils.LoadSampleVideoBytes())); } content.AddProperties(_properties.ToDictionary(data => data.Key, data => data.Val)); if (Activity == null) { Communities.PostActivity(content, Target, posted => { _console.LogD("Posted: " + posted); }, error => { _console.LogE("Failed to post: " + error); }); } else { Communities.UpdateActivity(Activity, content, posted => { _console.LogD("Updated: " + posted); }, error => { _console.LogE("Failed to update: " + error); }); } } }