public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.PageVideoPlayer, container, false); //Find all controls that need programmatic access _webView = view.FindViewById <WebView>(Resource.Id.webView1); _listView = view.FindViewById <ListView>(Resource.Id.listComments); _textDesc = view.FindViewById <TextView>(Resource.Id.textDesc); _textVotes = view.FindViewById <TextView>(Resource.Id.textVotes); _editComment = view.FindViewById <EditText>(Resource.Id.editComment); _commentButton = view.FindViewById <Button>(Resource.Id.buttonComment); _voteButton = view.FindViewById <ToggleButton>(Resource.Id.buttonVote); _webView.Settings.JavaScriptEnabled = true; Vm = Navigator.GetAndRemoveParameter <VideoViewModel>(ViewModelLocator.VIDEO_DETAILS); //Static data _webView.LoadUrl(Vm.FormattedURL); _textDesc.Text = Vm.Model.Description; //Bind data _votesBinding = this.SetBinding(() => Vm.VotesFormatted, () => TextVotes.Text); _voteStatusBinding = this.SetBinding(() => Vm.Model.HasUserVoted, () => VoteButton.Checked, BindingMode.OneWay); _commentBinding = this.SetBinding(() => EditComment.Text); VoteButton.SetCommand("Click", Vm.VoteCommand); CommentButton.SetCommand("Click", Vm.SaveCommentCommand, _commentBinding); ListView.Adapter = Vm.Model.Comments.GetAdapter(GetView); return(view); }
void Awake() { _count = 0; _voteButton = GetComponent <VoteButton> (); _finger = GameObject.Find("Finger").GetComponent <FInger>(); _master = _instractor.GetComponent <TextMaster>(); _finger.InVisible(); _descriptionText = GameObject.Find("Canvas/Panel/Description").GetComponent <Text>(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); SetContentView(Resource.Layout.PageVideoPlayer); _webView = FindViewById <WebView>(Resource.Id.webView1); _listView = FindViewById <ListView>(Resource.Id.listComments); _editComment = FindViewById <EditText>(Resource.Id.editComment); _commentButton = FindViewById <Button>(Resource.Id.buttonComment); var view = LayoutInflater.Inflate(Resource.Layout.HeaderVideoPlayer, ListView, false); _listView.AddHeaderView(view); _textDesc = view.FindViewById <TextView>(Resource.Id.textDesc); _textVotes = view.FindViewById <TextView>(Resource.Id.textVotes); _voteButton = view.FindViewById <ToggleButton>(Resource.Id.buttonVote); _webView.Settings.JavaScriptEnabled = true; try { var key = Intent.GetStringExtra(MyNavigationService.ParamKey); Vm = Navigator.GetAndRemoveParameter <VideoViewModel>(key); } catch (Exception e) { Console.WriteLine("Player opened without a video"); Finish(); return; } //Static data _webView.LoadUrl(Vm.FormattedURL); _textDesc.Text = Vm.Model.Description; //Bind data _votesBinding = this.SetBinding(() => Vm.VotesFormatted, () => TextVotes.Text); _voteStatusBinding = this.SetBinding(() => Vm.Model.HasUserVoted, () => VoteButton.Checked, BindingMode.OneWay); _commentBinding = this.SetBinding(() => EditComment.Text); VoteButton.SetCommand("Click", Vm.VoteCommand); CommentButton.SetCommand("Click", Vm.SaveCommentCommand, _commentBinding); _commentButton.Click += (sender, args) => { ((InputMethodManager)GetSystemService(InputMethodService)).HideSoftInputFromWindow( CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways); _editComment.Text = ""; }; _editComment.Click += delegate { _listView.SetSelection(Vm.Model.Comments.Count - 1); }; ListView.Adapter = Vm.Model.Comments.GetAdapter(GetView); }
void EndVoting() { voting = false; voteTime = voteStartTime; Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; VoteButton tempVoteButton = null; bool moreThanOne = false; int sceneInt = 0; int saveVoteAmount = 0; for (int i = 0; i < voteButtons.Count; i++) { if (tempVoteButton == null) { tempVoteButton = voteButtons[i]; } else if (tempVoteButton.voteAmount < voteButtons[i].voteAmount) { tempVoteButton = voteButtons[i]; moreThanOne = false; } else if (tempVoteButton.voteAmount == voteButtons[i].voteAmount) { moreThanOne = true; saveVoteAmount = tempVoteButton.voteAmount; } } if (moreThanOne) { List <VoteButton> tempVoteButtons = new List <VoteButton>(); for (int i = 0; i < voteButtons.Count; i++) { if (voteButtons[i].voteAmount == saveVoteAmount) { tempVoteButtons.Add(voteButtons[i]); } } sceneInt = tempVoteButtons[Random.Range(0, tempVoteButtons.Count - 1)].sceneIndex; } else { sceneInt = tempVoteButton.sceneIndex; } if (PhotonNetwork.IsMasterClient) { pv.RPC("LoadScene", RpcTarget.All, sceneInt); } }
// Use this for initialization void Start() { _voteButton = GameObject.Find("Manage").GetComponent <VoteButton> (); _finger = GameObject.Find("Finger").GetComponent <FInger> (); }