Ejemplo n.º 1
0
        void sc_clickEvent(int obj, SelectComponent obj2)
        {
            //    Console.WriteLine(obj);
            if (doIt && !pickDiff && !Game.pbox.expanded) //stupid but required
            {
                if (obj2.selected)
                {
                    pickDiffs();
                }
                else
                {
                    notPickDiffs();
                    index = obj;
                    changeSong();

                    /*   if (currentlySelected != null)
                     * {
                     *     currentlySelected.selected = false;
                     * }
                     * obj2.selected = true;
                     * currentlySelected = obj2;*/
                }
                doIt = false;
            }
        }
Ejemplo n.º 2
0
        private void refresh()
        { //todo show some animation during this
            transitioning = true;
            songNameList.Clear();
            SongLibrary.cacheSongInfo(); //prob should make separate method since searching forces cache refresh lol. we are good coders dont worry
            foreach (var pair in SongLibrary.songInfos)
            {
                Text temp = new Text(Config.ClientSize, new Size(550, 35), new Point(0, 0));

                /*SizeF temp1 = temp.getStringSize(pair.Value.Artist + " - " + pair.Value.SongName);
                 * temp.TextureSize = new Size((int)temp1.Width, (int)temp1.Height);*/
                temp.Update(pair.Value.Artist + " - " + pair.Value.SongName);
                temp.Shadow = true;
                SelectComponent sc = new SelectComponent(game, new Rectangle(-50, 0, 550, 90), pair.Value.Artist, pair.Value.SongName);
                sc.clickEvent += new Action <int, SelectComponent>(sc_clickEvent);
                SongPair sp = new SongPair(sc, pair.Value);
                songNameList.Add(sp);
                sc.index = songNameList.IndexOf(sp);
            }
            songNameList.Sort(new Comparison <SongPair>(delegate(SongPair f, SongPair j)
            {
                return(-f.Info.SongName.CompareTo(j.Info.SongName));
            }));
            foreach (SongPair sp in songNameList)
            {
                sp.select.index = songNameList.IndexOf(sp);
            }
        }
Ejemplo n.º 3
0
            public void ItShouldMatchStringWhenNotEmpty()
            {
                var result = new SelectComponent("*")
                             .GetValue();

                Assert.That(result == "SELECT *");
            }
Ejemplo n.º 4
0
    private GameObject MakeBackground()
    {
        GameObject g = new GameObject();

        g.name = "Background";
        g.transform.position = new Vector3(0, 0, 5);
        g.AddComponent <BoxCollider2D>().size = new Vector2(30, 30);
        ClickComponent c = g.AddComponent <ClickComponent>().Init();

        c.OnLeftClick = () =>
        {
            if (GameManager.instance.mMouseMode != GameManager.MouseMode.Selecting)
            {
                return;
            }
            Selected = null;
        };
        c.OnRightClick = () =>
        {
            if (GameManager.instance.mMouseMode != GameManager.MouseMode.Selecting)
            {
                return;
            }
            Selected = null;
        };

        return(g);
    }
Ejemplo n.º 5
0
    private SimCmd mCmds; // TODO Make an export for this, into ICommandSegment

    // Use this for initialization
    public void Start()
    {
        // Add Self Components
        mSelComp          = gameObject.AddComponent <SelectComponent>();
        mSelComp.OnSelect = () =>
        {
            mStartMarker.GetComponent <SpriteRenderer>().color = Color.yellow;
            mCmds.ShowAllButLast(true);
        };
        mSelComp.OnDeselect = () =>
        {
            mStartMarker.GetComponent <SpriteRenderer>().color = Color.blue;
            mCmds.ShowAllButLast(false);
        };

        // Make Cursor Ghost
        mCursorGhost = Draw.MakeGhost(gameObject);
        mCursorGhost.SetActive(false);

        // Make Guides
        mLGuide      = Draw.CreatePath(gameObject, "LeftGuide", Color.yellow);
        mRGuide      = Draw.CreatePath(gameObject, "RightGuide", Color.yellow);
        mCGuide      = Draw.CreatePath(gameObject, "CenterGuide", Color.green);
        mGapLine     = Draw.CreatePath(gameObject, "GapLine", Color.blue);
        mMovePreview = Draw.CreatePath(gameObject, "MovePreview", Color.red);
        EnableGuides(false);
        mCmds = new SimCmd();

        // Make End-of-Turn Ghost
        mEndGhost = Draw.MakeGhost(gameObject);
        mEndGhost.GetComponent <SpriteRenderer>().color       = Color.white;
        mEndGhost.GetComponent <ClickComponent>().OnLeftClick = () => ClickStart(false);

        // Make Start-of-turn Marker
        mStartMarker                         = new GameObject();
        mStartMarker.name                    = "StartMarker";
        mStartMarker.transform.parent        = gameObject.transform;
        mStartMarker.transform.localPosition = Vector3.zero + Vector3.back;
        mStartMarker.transform.localRotation = Quaternion.identity;
        Sprite sp = Resources.Load <Sprite>("Sprites/Member");

        if (sp == null)
        {
            throw new Exception("Failed to import sprite");
        }
        mStartMarker.AddComponent <SpriteRenderer>().sprite = sp;
        CircleCollider2D c = mStartMarker.AddComponent <CircleCollider2D>();

        c.offset = Vector2.zero;
        c.radius = 0.13f;
        mStartMarker.AddComponent <ClickComponent>().Init().OnLeftClick = () => ClickStart(true);

        // Initial Cmds
        ResetCmds();
    }
Ejemplo n.º 6
0
 private void changeSong()
 {
     if (background != null)
     {
         Game.M.setSong(ref songNameList[index].Info);
         currentSong  = Game.M.CurrentSong;
         targetVolume = Config.Volume / 100.0f;
         Music.stop();
         string bgString = "";
         if (currentSong.FileVersion == 0)
         {
             bgString = currentSong.BgName;
         }
         else
         {
             bgString = currentSong.Charts[0].BgName;
         }
         background.useTexture("songs\\" + currentSong.Dir + "\\" + bgString);
         updateScoreLabels(0);
         music                 = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName);
         Music.Volume          = 0.0f;
         Music.PositionAsMilli = (long)currentSong.Preview;
         Music.play(false, true);
         changed       = true;
         transitioning = true;
         difficultyTexts.Clear();
         updateDiffs();
     }
     for (int x = 0; x < songNameList.Count; x++)
     {
         songNameList[x].select.moveY(new Point(songNameList[x].select.Bounds.X, 246 + ((x - index) * 90)), 0.3);
     }
     if (currentlySelected != null)
     {
         currentlySelected.selected = false;
     }
     songNameList[index].select.selected = true;
     currentlySelected = songNameList[index].select;
 }
Ejemplo n.º 7
0
 //This class was to prevent a bug with songs that occured when adding a new song for the first time - SongLibrary.Songs has new songs appended to the end of the list; however, since songInfos is a sorted dictionary it is sorted based on key, and the new song is not added to the end of the list. Song labels are added based on songInfos, while selection is based on the Song, causing a conflict
 public SongPair(SelectComponent t, SongInfo s)
 {
     select = t;
     Info   = s;
 }