public SvgImage( ) : base( )
        {
            if( ReplacementColors == null )
                ReplacementColors = new ColorPairs( );

            ApplyTemplate( );
        }
Example #2
0
        private static void OnReplacementColorsPropertyChanged(BindableObject d, ColorPairs in_OldValue, ColorPairs in_NewValue)
        {
            SvgImage element = d as SvgImage;

            if (element == null)
            {
                return;
            }

            if (in_OldValue != null)
            {
                in_OldValue.CollectionChanged -= element.ColorPairs_CollectionChanged;
            }

            if (in_NewValue != null)
            {
                in_NewValue.CollectionChanged -= element.ColorPairs_CollectionChanged;
                in_NewValue.CollectionChanged += element.ColorPairs_CollectionChanged;
            }

            if (in_NewValue == in_OldValue)
            {
                return;
            }

            element.OnReplacementColorsChanged( );
        }
Example #3
0
        public SvgImage( ) : base( )
        {
            if (ReplacementColors == null)
            {
                ReplacementColors = new ColorPairs( );
            }

            ApplyTemplate( );
        }
        private static void OnReplacementColorsPropertyChanged( BindableObject d, ColorPairs in_OldValue, ColorPairs in_NewValue )
        {
            SvgImage element = d as SvgImage;

            if( element == null )
                return;

            if( in_OldValue != null )
                in_OldValue.CollectionChanged -= element.ColorPairs_CollectionChanged;

            if( in_NewValue != null )
            {
                in_NewValue.CollectionChanged -= element.ColorPairs_CollectionChanged;
                in_NewValue.CollectionChanged += element.ColorPairs_CollectionChanged;
            }

            if( in_NewValue == in_OldValue )
                return;

            element.OnReplacementColorsChanged( );
        }
Example #5
0
    IEnumerator NoticeDay()
    {
        bool       vaildPair    = false;
        ColorPairs selectedPair = new ColorPairs(0, 0);

        while (vaildPair == false)
        {
            int address = (int)Random.Range(0, NoticeColors.Length);
            selectedPair = NoticeColors[address];
            if (UsedPairs.Count != 0)
            {
                foreach (var pair in UsedPairs)
                {
                    if (selectedPair.Color1 == pair.Color1 || selectedPair.Color1 == pair.Color2 || selectedPair.Color2 == pair.Color1 || selectedPair.Color2 == pair.Color2)
                    {
                        vaildPair = false;
                        break;
                    }
                    else
                    {
                        vaildPair = true;
                    }
                }
            }
            else
            {
                vaildPair = true;
            }
            if (vaildPair)
            {
                UsedPairs.Add(selectedPair);
            }
        }

        //=============================================

        Notices notices1 = new Notices(selectedPair.Color1, selectedPair.Color2);

        foreach (var project in projects)
        {
            project.swapData(selectedPair.Color1, selectedPair.Color2);
        }
        notices.Add(notices1);
        notices1.ChangecolorMeaning();
        noticeDay        += 1;
        notices1.NoticeID = notices.Count;

        GameObject Button;

        Button = Instantiate(Noticedetails, new Vector2(2, 2), Quaternion.identity, NoticePanel.transform);
        Button.GetComponent <NoticeDetails>().NoticeInfoChange(notices1.C1, notices1.C2, notices1.NoticeID);
        string tempString = notices1.NoticeMessage;

        //updateNoticeText(notices1.NoticeMessage);
        Events.ChangeNotice(notices1.C1, notices1.C2, tempString);
        Events.noticeScreen();

        //Debug.Log("next notice day is on " + noticeDay.ToString());
        //StartCoroutine(Daytimer());


        yield return(new WaitForSeconds(daySeconds + 1f));
    }