void ReleaseDesignerOutlets()
        {
            if (BtnLeft != null)
            {
                BtnLeft.Dispose();
                BtnLeft = null;
            }

            if (BtnRight != null)
            {
                BtnRight.Dispose();
                BtnRight = null;
            }

            if (BtnSelStart != null)
            {
                BtnSelStart.Dispose();
                BtnSelStart = null;
            }

            if (MapContainer != null)
            {
                MapContainer.Dispose();
                MapContainer = null;
            }
        }
Exemple #2
0
 private void btnTotalRight_MouseClick(object sender, MouseEventArgs e)
 {
     lathatosagok();
     Left = Screen.PrimaryScreen.Bounds.Width - Width;
     //SetVisibleCore(true);
     btnTotalRight.Hide();
     BtnRight.Hide();
 }
Exemple #3
0
 public void GotoNextCharacter()
 {
     UMengPlugin.UMengEvent(EventId.SWITCH_CHARACTER_VIEW,
                            new Dictionary <string, object> {
         { "from_ind", _index }, { "to_ind", (_index + 1) }
     });                                                                                                         //发送统计事件
     if (_index >= _characterList.Count - 1)
     {
         BtnRight.SetActive(false);
         return;
     }
     _index++;
     UpperSetAndRefresh(_index);
 }
Exemple #4
0
        private void UpperSetAndRefresh(int index)
        {
            LblLevel.text = string.Format("{0}", CommonData.MyUser.Level);
            LblExp.text   = string.Format("{0}/{1}", CommonData.MyUser.Exp, CommonData.MyUser.ExpCeil);
            SldExp.value  = 1f * CommonData.MyUser.Exp / CommonData.MyUser.ExpCeil;

            var attack      = 0;
            var health      = CommonData.MyUser.RoundInitHealth;
            var equipConfig = ConfigManager.GetConfig(ConfigManager.ConfigType.EquipConfig) as EquipConfig;

            if (equipConfig != null)
            {
                var myUserCharacter =
                    CommonData.MyCharacterList.Find(x => x.CharacterCode == CommonData.MyUser.CharacterCode);
                if (myUserCharacter != null)
                {
                    foreach (var equip in myUserCharacter.WearEquipList.Select(equipCode => equipConfig.EquipList.Find(x => x.EquipCode == equipCode)).Where(equip => equip != null))
                    {
                        attack += (int)equip.AttackAdd;
                        health += (int)equip.HealthAdd;
                        MyCharacter.WearEquip(equip.Type, equip.EquipCode);//角色穿装备
                    }
                }
            }
            LblAttack.text  = attack.ToString();
            LblDefense.text = health.ToString();


            if (_characterList.Count == 0)
            {
                Debug.LogError("_characterList.Count == 0 ERROR");
                return;
            }
            if (_equipConfig == null)
            {
                return;
            }

            _index = Mathf.Clamp(index, 0, _characterList.Count - 1);
            MyCharacter.CharacterCode = CurCharacterCode;
            MyCharacter.Refresh();
            MyCharacter.TakeOffAllEquip();
            var sprs = MyCharacter.GetComponentsInChildren <SpriteRenderer>(true);

            foreach (var spriteRenderer in sprs)
            {
                spriteRenderer.sortingLayerName = "Foreground";
            }
            var curUserCharacter = CommonData.MyCharacterList.Find(x => x.CharacterCode == CurCharacterCode);

            if (curUserCharacter == null) //未解锁
            {
                GrpLockedCharacter.SetActive(true);
                GrpUnlockedCharacter.SetActive(false);

                if (_characterIntroTextConfig == null)
                {
                    _characterIntroTextConfig =
                        ConfigManager.GetConfig(ConfigManager.ConfigType.CharacterIntroTextConfig) as
                        CharacterIntroTextConfig;
                }
                if (_characterIntroTextConfig != null)
                {
                    var intro = _characterIntroTextConfig.IntroList.Find(x => x.CharacterCode == CurCharacterCode);
                    if (intro != null)
                    {
                        LblCharacterDescription.text = intro.Description;
                        LblCharacterTalent.text      = intro.TalentIntro;
                    }
                    else
                    {
                        Debug.LogError("没有CharacterIntro。Code:" + CurCharacterCode);
                        LblCharacterDescription.text = null;
                        LblCharacterTalent.text      = null;
                    }
                }
                else
                {
                    Debug.LogError("没有CharacterIntroTextConfig");
                    LblCharacterDescription.text = null;
                    LblCharacterTalent.text      = null;
                }
            }
            else//已解锁
            {
                GrpUnlockedCharacter.SetActive(true);
                GrpLockedCharacter.SetActive(false);

                //出战按钮
                if (CommonData.MyUser.CharacterCode == CurCharacterCode)
                {
                    BtnChuzhan.isEnabled = false;
                    Tick.enabled         = true;
                }
                else
                {
                    BtnChuzhan.isEnabled = true;
                    Tick.enabled         = false;
                }

                for (int type = 0; type < 5; type++)
                {
                    SprEquips[type].enabled = false;
                }
                foreach (var code in curUserCharacter.WearEquipList)
                {
                    var equip = _equipConfig.EquipList.Find(x => x.EquipCode == code);

                    if (equip == null)
                    {
                        Debug.LogError("找不到配置Equip:" + code);
                        continue;
                    }

                    var type = equip.Type;
                    SprEquips[type].atlas =
                        MorlnDownloadResources.Load <UIAtlas>("ResourcesForDownload/Equip/EquipIcon/Atlas-EquipIcons");
                    var sprName = EquipUtil.GetEquipSpriteName(code, type);
                    //var spr = Resources.Load<Sprite>("Sprites/Equip/" + sprName);
                    SprEquips[type].enabled = true;
                    //SprEquips[type].sprite = spr;
                    SprEquips[type].spriteName = sprName;

                    MyCharacter.WearEquip(type, code);
                }
            }

            BtnLeft.SetActive(_index > 0);
            BtnRight.SetActive(_index < _characterList.Count - 1);
        }
Exemple #5
0
        protected override void OnCreate(Bundle bundle)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            var view = Resource.Layout.Main;

            SetContentView(view);

            VisorVideo        = FindViewById <MjpegView>(Resource.Id.mjpegView);
            LblMensaje        = FindViewById <TextView>(Resource.Id.textMensaje);
            BtnForward        = FindViewById <ImageButton>(Resource.Id.imageButtonForward);
            BtnBackward       = FindViewById <ImageButton>(Resource.Id.imageButtonBackward);
            BtnLeft           = FindViewById <ImageButton>(Resource.Id.imageButtonLeft);
            BtnRight          = FindViewById <ImageButton>(Resource.Id.imageButtonRight);
            BtnStop           = FindViewById <ImageButton>(Resource.Id.imageButtonStop);
            BtnLuces          = FindViewById <ImageButton>(Resource.Id.imageButtonLeds);
            BtnSettings       = FindViewById <ImageButton>(Resource.Id.imageButtonSetting);
            BtnCentrarCamara  = FindViewById <Button>(Resource.Id.btnCentrarCamara);
            HorizontalSeekBar = FindViewById <SeekBar>(Resource.Id.horizontalSeekBar);
            VerticalSeekBar   = FindViewById <VerticalSeekBar>(Resource.Id.verticalSeekBar);

            VisorVideo?.SetResolution(widthVideoResolution, heightVideoResolution);

            BtnForward.Touch += (sender, args) =>
            {
                if (args.Event.Action == MotionEventActions.Down)
                {
                    BtnForward.SetImageResource(Resource.Drawable.sym_forward_1);
                    SendData(CMD_Forward);
                }
                else if (args.Event.Action == MotionEventActions.Up)
                {
                    SendData(CMD_Stop);
                    BtnForward.SetImageResource(Resource.Drawable.sym_forward);
                }
            };
            BtnBackward.Touch += (sender, args) =>
            {
                if (args.Event.Action == MotionEventActions.Down)
                {
                    BtnBackward.SetImageResource(Resource.Drawable.sym_backward_1);
                    SendData(CMD_Backward);
                }
                else if (args.Event.Action == MotionEventActions.Up)
                {
                    SendData(CMD_Stop);
                    BtnBackward.SetImageResource(Resource.Drawable.sym_backward);
                }
            };
            BtnLeft.Touch += (sender, args) =>
            {
                if (args.Event.Action == MotionEventActions.Down)
                {
                    BtnLeft.SetImageResource(Resource.Drawable.sym_left_1);
                    SendData(CMD_TurnLeft);
                }
                else if (args.Event.Action == MotionEventActions.Up)
                {
                    SendData(CMD_Stop);
                    BtnLeft.SetImageResource(Resource.Drawable.sym_left);
                }
            };
            BtnRight.Touch += (sender, args) =>
            {
                if (args.Event.Action == MotionEventActions.Down)
                {
                    BtnRight.SetImageResource(Resource.Drawable.sym_right_1);
                    SendData(CMD_TurnRight);
                }
                else if (args.Event.Action == MotionEventActions.Up)
                {
                    SendData(CMD_Stop);
                    BtnRight.SetImageResource(Resource.Drawable.sym_right);
                }
            };
            BtnStop.Touch += (sender, args) =>
            {
                try
                {
                    if (args.Event.Action == MotionEventActions.Down)
                    {
                        //BeginStreaming(CameraUrl);
                        //RequestedOrientation = RequestedOrientation == ScreenOrientation.Landscape
                        //    ? ScreenOrientation.ReverseLandscape
                        //    : ScreenOrientation.Landscape;
                        verFPS = !verFPS;
                        VisorVideo.SetDisplayMode(MjpegView.SizeStandard);
                        VisorVideo.SetDisplayMode(MjpegView.SizeFullscreen);
                        VisorVideo.ShowFps(verFPS);
                    }
                }
                catch (Exception ex)
                {
                    LblMensaje.Text = ex.Message;
                }
            };
            BtnLuces.Touch += (sender, args) =>
            {
                try
                {
                    if (args.Event.Action == MotionEventActions.Down)
                    {
                        ledsOn = !ledsOn;
                        SendData(ledsOn ? CMD_ledon : CMD_ledoff);
                        BtnLuces.SetImageResource(ledsOn ? Resource.Drawable.sym_light : Resource.Drawable.sym_light_off);
                    }
                }
                catch (Exception ex)
                {
                    LblMensaje.Text = ex.Message;
                }
            };
            BtnSettings.Touch += (sender, args) =>
            {
                try
                {
                    if (args.Event.Action == MotionEventActions.Down)
                    {
                        StartActivity(typeof(Settings));
                    }
                }
                catch (Exception ex)
                {
                    LblMensaje.Text = ex.Message;
                }
            };
            HorizontalSeekBar.Max      = MaxCameraServoValue;
            HorizontalSeekBar.Progress = 90;
            var waitingX = false;

            HorizontalSeekBar.ProgressChanged += (sender, args) =>
            {
                if (args.Progress >= MinCameraServoValue)
                {
                    if (!waitingX)
                    {
                        Task.Factory.StartNew(() =>
                        {
                            waitingX = true;
                            Thread.Sleep(50);
                            waitingX = false;
                            RunOnUiThread(() => SendData($"{CMD_SetServoX}{args.Progress}"));
                        });
                    }
                }
            };
            VerticalSeekBar.Max      = MaxCameraServoValue;
            VerticalSeekBar.Progress = 90;
            VerticalSeekBar.LayoutParameters.Width = ViewGroup.LayoutParams.WrapContent;
            var waitingY = false;

            VerticalSeekBar.ProgressChanged += (sender, args) =>
            {
                if (args.Progress >= MinCameraServoValue)
                {
                    if (!waitingY)
                    {
                        Task.Factory.StartNew(() =>
                        {
                            waitingY = true;
                            Thread.Sleep(50);
                            waitingY = false;
                            RunOnUiThread(() => SendData($"{CMD_SetServoY}{args.Progress}"));
                        });
                    }
                }
            };
            BtnCentrarCamara.Click += (sender, args) =>
            {
                VerticalSeekBar.Progress = 90;
                Thread.Sleep(100);
                HorizontalSeekBar.Progress = 90;
            };
            // Get our button from the layout resource,
            // and attach an event to it
            //var button = FindViewById<Button>(Resource.Id.btnAlert);
            //LblMensaje = FindViewById<TextView>(Resource.Id.lblMessage);
            //button.Click += (sender, args) =>
            //{
            //    //var textBox = FindViewById<TextView>(Resource.Id.txtBox1);
            //    //Console.WriteLine(textBox.Text);
            //    //var alert = new AlertDialog.Builder(this);
            //    //alert.SetMessage(textBox.Text);
            //    //alert.SetTitle("Toma mensajaco");
            //    //alert.SetNeutralButton("OK", new EventHandler<DialogClickEventArgs>((sender, args) => { }));
            //    //alert.Show();
            //    DetectNetwork();
            //};
            BeginStreaming(CameraUrl);
        }