protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); LinearLayout circleMenu = FindViewById <LinearLayout>(Resource.Id.radialMenu); wheelMenu = (WheelMenu)FindViewById(Resource.Id.radialMenu); //set the no of divisions in the wheel, default is 1 wheelMenu.SetDivCount(12); //set the drawable to be used as the wheel image. If you //don't set this, you'll get a NullPointerException. wheelMenu.SetWheelImage(Resource.Drawable.wheel); wheelMenu.Click += WheelMenu_Click; //shopMyCo.SetOnRadialMenuClickListener(new RadialMenuRenderer.IOnRadailMenuClick() //{ //}); // shopMyCo.SetOnRadialMenuClickListener(new RadialMenuItem.OnRadailMenuClick { }); //btnShopMyco = FindViewById<Button>(Resource.Id.btnShopMyco); //btnShopMyco.Click += BtnShopMyco_Click; //btnShopHerbs = FindViewById<Button>(Resource.Id.btnShopHerbs); //btnShopHerbs.Click += BtnShopHerbs_Click; //btnShopBoutique = FindViewById<Button>(Resource.Id.btnBoutique); //btnShopBoutique.Click += BtnBoutique_Click; }
public AttachmentWheel(Carousel <Attachment> attachments) { ATTACHMENTS = attachments; CANVAS = GameObject.Find(CANVAS_NAME); wheel = new Wheel(); int numberOfNonPassiveAttachments = 0; foreach (Attachment attachment in ATTACHMENTS) { if (!attachment.isPassive()) { ++numberOfNonPassiveAttachments; } } wheel.wheelElements = new WheelElement[numberOfNonPassiveAttachments]; int attachmentIndex = 0; foreach (Attachment attachment in ATTACHMENTS) { if (!attachment.isPassive()) { wheel.wheelElements[attachmentIndex] = new WheelElement(); wheel.wheelElements[attachmentIndex++].Icon = Sprite.Create(attachment.getImage().getTexture(), new Rect(0, 0, attachment.getImage().getTexture().width, attachment.getImage().getTexture().height), new Vector2(0.5f, 0.5f), 100); } } if (GameObject.FindObjectOfType <Canvas>() != null) { MAIN_MENU = GameObject.Find(MAIN_MENU_NAME).GetComponent <WheelMenu>(); MAIN_MENU.transform.SetParent(CANVAS.transform); MAIN_MENU.transform.localPosition = new Vector3(CANVAS.GetComponent <RectTransform>().sizeDelta.x / 2 + MAIN_MENU.GetComponent <RectTransform>().sizeDelta.x / 6, 0, 0); MAIN_MENU.initialize(wheel); } }