Beispiel #1
0
    void DisplayLargeCardView(string id)
    {
        // todo: don't replace "'" with "" here. replace that when reading data from Google Drive
        Debug.Log("MatchController:CardPointerClick()");
        largeCardViewObj = GameObject.Instantiate(LargeCardViewPrefab);
        largeCardViewObj.transform.SetParent(Canvas.transform, false);
        largeCardView = (LargeCardView)largeCardViewObj.GetComponent("LargeCardView");
        CardLevelSheet c = GameManager.Instance.CardData[id];

        largeCardView.Id = c.ID;
        largeCardView.SetCost(c.Cost);
        largeCardView.SetLevel(c.Level);
        largeCardView.SetName(c.Name);
        largeCardView.SetType(c.Type);
        largeCardView.SetSubtype(c.Subtype);
        largeCardView.SetText(c.Text);
        largeCardView.PreviousDel  = LUVPrevious;
        largeCardView.NextDel      = LUVNext;
        largeCardView.BackDel      = LUVBack;
        largeCardView.Image.sprite = Resources.Load <Sprite> (c.Art);         // todo: SetImage and make Image not settable publicly
        largeCardView.SetRarity(c.Rarity);
        largeCardView.SetFaction(c.Faction);

        largeCardViewVisible = true;
    }
Beispiel #2
0
 public void LUVBack(LargeCardView v)
 {
     Debug.Log("LargeUnitController:Back");
     GameObject.Destroy(largeCardViewObj);
     largeCardView        = null;
     largeCardViewVisible = false;
 }
Beispiel #3
0
 void LUVNext(LargeCardView v)
 {
     if (level < 3)
     {
         level++;
     }
     SetLUVText(v, level);
 }
Beispiel #4
0
    void LUVPrevious(LargeCardView v)
    {
        if (level > 1)
        {
            level--;
        }

        SetLUVText(v, level);
    }
Beispiel #5
0
    void SetLUVText(LargeCardView v, int level)
    {
        Card           c  = GameManager.Instance.Cards[v.Id];
        CardLevelSheet cs = c.GetLevelSheet(level);

        v.SetLevel(cs.Level);
        v.SetLevel(cs.Level);
        v.SetText(cs.Text);
    }
Beispiel #6
0
    IEnumerator UnitViewOver(UnitView v)
    {
        Unit u = units[v];

        TileOnMouseOver(mapView.GetTileViewAt(units[v].Location));
//		Debug.Log("MatchController:UnitViewOver " + v.ToString());
//		v.SetColor(Color.yellow);
        if (Input.GetMouseButtonDown(0))
        {
            mouseDownTime = Time.time;
        }
        if (Input.GetMouseButtonUp(0))
        {
            //Tile t = map.GetTileAt(u.Location);
            //TileView tv = mapView.GetTileViewAt(u.Location);
            //if (map.OriginTile == null)
            //{
            //	if (t.Location.Equals(currentPlayer.Location) && !IsUnitMoving())
            //	{
            //		map.OriginTile = t;
            //		mapView.OriginTileView = tv;
            //	}
            //	else
            //	{
            //		Debug.Log ("you clicked somewhere that doesn't work");
            //	}
            //}
            //else if (!map.DestinationSelected)
            //{
            //	map.SelectedTile = t;
            //	map.DestinationSelected = true;

            //	mapView.SelectedTileView = tv;
            //	mapView.Clear();

            //	Path<Tile> path = map.FindPath();
            //	List<TileView> pathViews = new List<TileView>();
            //	foreach (Tile tile in path)
            //	{
            //		pathViews.Add (mapView.GetTileViewAt(tile.Location));
            //	}

            //	mapView.SetPathViews(pathViews);
            //	unitViews[currentPlayer].SetPathViews(pathViews);
            //	mapView.DrawSelectedPath();
            //}
            //else if (map.DestinationSelected)
            //{
            //	if (t == map.SelectedTile)
            //	{
            //		List<Tile> thePath = new List<Tile>();
            //		Path<Tile> myPath = map.FindPath();
            //		List<TileView> myPathViews  = new List<TileView>();

            //		foreach (Tile tile in myPath)
            //		{
            //			thePath.Add(tile);
            //			myPathViews.Add (mapView.GetTileViewAt(tile.Location));
            //		}

            //		currentPlayer.Location = thePath[0].Location;
            //		mapView.DrawSelectedPath();

            //		yield return StartCoroutine(unitViews[currentPlayer].Walk());

            //		yield return StartCoroutine(TakeTurn());

            //		map.Reset();
            //		map.OriginTile = null;
            //		map.SelectedTile = null;
            //		map.DestinationSelected = false;
            //		mapView.Clear();
            //	}
            //	else
            //	{
            //		Debug.Log("didn't confirm selection");
            //	}
            //}

            selectedUnit = v;
            if (!unitOverlayVisible && !largeCardViewVisible)
            {
                if ((Time.time - mouseDownTime) > longClickLength)
                {
                    largeCardViewObj = GameObject.Instantiate(LargeCardViewPrefab);
                    largeCardViewObj.transform.SetParent(Canvas.transform, false);
                    largeCardView = (LargeCardView)largeCardViewObj.GetComponent("LargeCardView");
                    // todo: get CardLevelSheet for selected unit
                    largeCardView.Id = "10";                    // todo: get id of selected unit
                    largeCardView.SetName(u.Name);
                    largeCardView.SetType(u.Type);
                    largeCardView.SetSubtype(u.Subtype);
                    largeCardView.SetText(u.LevelOneText);
                    largeCardView.PreviousDel = LUVPrevious;
                    largeCardView.NextDel     = LUVNext;
                    largeCardView.BackDel     = LUVBack;
                    largeCardView.SetRarity("Common");
//					largeCardView.Image.sprite = Resources.Load(u.a
                    largeCardViewVisible = true;
                }
            }
        }
        if (Input.GetMouseButtonUp(1))
        {
            Debug.Log("right click");
            if (!unitOverlayVisible)
            {
                unitOverlayViewObj = GameObject.Instantiate(UnitOverlayViewPrefab);
                unitOverlayViewObj.transform.SetParent(Canvas.transform, false);
                unitOverlayView           = (UnitOverlayView)unitOverlayViewObj.GetComponent("UnitOverlayView");
                unitOverlayView.MagicDel  = UnitOverlayViewMagic;
                unitOverlayView.AttackDel = UnitOverlayViewAttack;
                unitOverlayView.MoveDel   = UnitOverlayViewMove;

                unitOverlayVisible = true;
            }
            else
            {
                unitOverlayVisible = false;

                if (unitOverlayViewObj != null)
                {
                    GameObject.Destroy(unitOverlayViewObj);
                    unitOverlayView    = null;
                    unitOverlayVisible = false;
                }
            }
        }

        yield return(new WaitForSeconds(0.0f));
    }