예제 #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.dialog_layout, container, false);

            leftTitle   = view.FindViewById <TextView>(Resource.Id.leftTitle);
            middleTitle = view.FindViewById <TextView>(Resource.Id.middleTitle);
            rightTitle  = view.FindViewById <TextView>(Resource.Id.rightTitle);

            topLeft     = view.FindViewById <TextView>(Resource.Id.leftTop);
            attackTitle = view.FindViewById <TextView>(Resource.Id.attackText);

            layout1 = view.FindViewById <LinearLayout>(Resource.Id.layout1);
            layout2 = view.FindViewById <LinearLayout>(Resource.Id.layout2);
            layout3 = view.FindViewById <LinearLayout>(Resource.Id.layout3);

            List <string> weakness   = SendData.sendAttackType[0].effective;
            List <string> resistance = SendData.sendAttackType[0].resistance;
            List <string> immune     = SendData.sendAttackType[0].immune;

            topLeft.Text = SendData.sendAttackType[0].type;
            topLeft.SetBackgroundColor(Color.ParseColor(Colors.TypeToColor[topLeft.Text]));

            AddTypeData.PopulateTF(weakness, layout1, 2, owner);
            AddTypeData.PopulateTF(resistance, layout2, .5, owner);
            AddTypeData.PopulateTF(immune, layout3, 0, owner);

            return(view);
        }
예제 #2
0
        void Handle_Click(object sender, EventArgs e)
        {
            int num = (int)((TextView)sender).Tag;

            gradient = (GradientDrawable)textViews[num].Background;

            removeChilren(layout1);
            removeChilren(layout2);
            removeChilren(layout3);

            if (leftSide.num == num)
            {
                removeTop(left, leftSide);
            }
            else if (rightSide.num == num)
            {
                removeTop(right, rightSide);
            }
            else
            {
                gradient.SetColor(Color.Aqua);

                if (left.Text == "")
                {
                    left.Text = types[num].type;
                    left.SetBackgroundColor(Color.ParseColor(Colors.TypeToColor[left.Text]));
                    leftSide.type = types[num];
                    leftSide.num  = num;
                }
                else if (right.Text == "")
                {
                    right.Text = types[num].type;
                    right.SetBackgroundColor(Color.ParseColor(Colors.TypeToColor[right.Text]));
                    rightSide.type = types[num];
                    rightSide.num  = num;
                }
                else if (leftTurn)
                {
                    left.Text = types[num].type;
                    left.SetBackgroundColor(Color.ParseColor(Colors.TypeToColor[left.Text]));
                    leftTurn = false;
                    gradient = (GradientDrawable)textViews[leftSide.num].Background;
                    gradient.SetColor(Color.ParseColor(Colors.TypeToColor[types[leftSide.num].type]));
                    leftSide.type = types[num];
                    leftSide.num  = num;
                }
                else if (!leftTurn)
                {
                    right.Text = types[num].type;
                    right.SetBackgroundColor(Color.ParseColor(Colors.TypeToColor[right.Text]));
                    leftTurn = true;
                    gradient = (GradientDrawable)textViews[rightSide.num].Background;
                    gradient.SetColor(Color.ParseColor(Colors.TypeToColor[types[rightSide.num].type]));
                    rightSide.type = types[num];
                    rightSide.num  = num;
                }
            }

            List <string> weakness   = new List <string>();
            List <string> resistance = new List <string>();
            List <string> immune     = new List <string>();

            if (leftSide.type != null && rightSide.type != null)
            {
                weakness   = leftSide.type.effective.Concat(rightSide.type.effective).ToList();
                resistance = leftSide.type.resistance.Concat(rightSide.type.resistance).ToList();
                immune     = leftSide.type.immune.Concat(rightSide.type.immune).ToList();

                weakness.Sort();
                resistance.Sort();
                immune.Sort();

                AddTypeData.RemoveDoubles(weakness, resistance, immune);
            }
            else if (leftSide.type != null && rightSide.type == null)
            {
                weakness   = leftSide.type.effective;
                resistance = leftSide.type.resistance;
                immune     = leftSide.type.immune;
            }
            else if (rightSide.type != null && leftSide.type == null)
            {
                weakness   = rightSide.type.effective;
                resistance = rightSide.type.resistance;
                immune     = rightSide.type.immune;
            }

            AddTypeData.PopulateTF(weakness, layout1, 2, this);
            AddTypeData.PopulateTF(resistance, layout2, .5, this);
            AddTypeData.PopulateTF(immune, layout3, 0, this);
        }