Ejemplo n.º 1
0
    void Awake()
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            Debug.Log("on iphone");
//			System.Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes");
            Debug.Log("didn't error");
        }

        EventControl.NewLevelReset();
        QControl.Initialize();

        playsLeftText = GameObject.Find("plays left #").GetComponent <TextMesh> ();
        movesLeftText = GameObject.Find("moves left #").GetComponent <TextMesh> ();
        dollarsText   = GameObject.Find("Dollar count").GetComponent <TextMesh> ();
        deckText      = GameObject.Find("Deck count").GetComponent <TextMesh> ();
        playButton    = GameObject.Find("play end button").GetComponent <ButtonAnimate> ();
        moveButton    = GameObject.Find("move end button").GetComponent <ButtonAnimate> ();
        endTurnButton = GameObject.Find("end turn button").GetComponent <ButtonAnimate> ();
        handObj       = GameObject.Find("Hand");
        playBoardObj  = GameObject.Find("Play board");
        playerObj     = GameObject.FindGameObjectWithTag("Player");
        player        = GameObject.FindGameObjectWithTag("Player").GetComponent <Player> ();
        gooeyskin     = (GUISkin)Resources.Load("GUISkins/S.GameControlInst.guiskin");

        SaveDataControl.Load();
        StateSavingControl.Initialize(this, player);

        if (SaveDataControl.UnlockedCards.Count == 0 | SaveDataControl.UnlockedGods.Count == 0)
        {
            SaveDataControl.NewSaveFile();
        }

        MainMenu.UnlockCheck();
    }
Ejemplo n.º 2
0
 public void makeColor(ROW row, int columnNum, Brush color)
 {
     withGuiRow(row, guiRow => {
         var cellBlock = (TextBlock)Columns[columnNum].GetCellContent(guiRow);
         if (cellBlock == null)
         {
             return;
         }
         var cell = (DataGridCell)LogicalTreeHelper.GetParent(cellBlock);
         QControl.makeColor(this, cell, color);
     });
 }
Ejemplo n.º 3
0
    public void DiscardOrBurnIfNotInQ()
    {
        if (!QControl.QContains(this))
        {
            if (BurnsSelfWhenPlayed)
            {
                Burn();
            }
        }

        if (!BurnsSelfWhenPlayed && !Discarded)
        {
            Discard();
        }
    }
Ejemplo n.º 4
0
        public void addEquity(Simulator simulator)
        {
            Bomb.when(Objects.hasContent(equity), () => "equity has content already: " + Objects.toShortString(equity));
            equity.AddRange(simulator.equity(symbol));
            var points = new PointPairList();

            Objects.eachIt(simulator.equity(symbol), (i, value) => points.Add(i + 1, value));
            var curve = AddCurve("equity", points, Color.Red);

            curve.Symbol.IsVisible  = false;
            curve.IsOverrideOrdinal = true;
            var zero = new LineObj(Color.Gray, 1, 0, bars.count(), 0)
            {
                Line = { Style = DashStyle.Dash }, Location = { CoordinateFrame = CoordType.AxisXYScale }
            };

            GraphObjList.Add(zero);
            AxisChange();
            var graphable = new EquityGraphable("equity", simulator.equity(symbol), simulator.dates(symbol));

            graphables.Add(graphable);

            var needsNewPoint = false;

            bars.pushedDown += () => needsNewPoint = true;
            bars.valueSet   += bar => {
                var value           = simulator.pnl(symbol);
                var todaysMarketPnl = Objects.sum(Objects.convert(simulator.positions(symbol), position => position.pnl(bars[1].close, bars[0].close)));
                value += todaysMarketPnl;
                graphable.add(bar.time, value);
                QControl.runOnGuiThread(dispatchTo, () => {
                    var lastPoint = curve[curve.Points.Count - 1];
                    if (needsNewPoint)
                    {
                        curve.AddPoint(lastPoint.X + 1, value);
                        equity.Add(value);
                    }
                    else
                    {
                        lastPoint.Y = value;
                        equity[equity.Count - 1] = value;
                    }
                    BarSpudGraph.addEquityTo(Objects.first(parentTyped.dataTable().Rows), value);
                    needsNewPoint = false;
                    parentTyped.Invalidate();
                });
            };
        }
Ejemplo n.º 5
0
    public override void AfterCardTargetingCallback()
    {
        Card.Rarity discardRarity = Rarity.Paper;

        foreach (GameObject tempGO in S.GameControlInst.TargetedCards)
        {
            Card c = tempGO.GetComponent <Card>();
            discardRarity = c.ThisRarity;
            c.Discard();
        }

        if (discardRarity == Rarity.Paper)
        {
            x = 1;
        }
        if (discardRarity == Rarity.Bronze)
        {
            x = 2;
        }
        if (discardRarity == Rarity.Silver)
        {
            x = 3;
        }
        if (discardRarity == Rarity.Gold)
        {
            x = 4;
        }
        if (discardRarity == Rarity.Platinum)
        {
            x = 5;
        }

        S.GridControlInst.EnterTargetingMode(GridControl.TargetTypes.diamond, 1, x);

        //these must be done manually because after targeting a card, you must finish the card action by attacking.
        S.ClickControlInst.DisallowEveryInput();
        S.ClickControlInst.AllowInfoInput         = true;
        S.ClickControlInst.AllowSquareTargetInput = true;
        S.GameControlInst.TargetSquareCallback    = this;

        QControl.AddToQ(this, QControl.QMethodType.FreeSpecial);

        base.AfterCardTargetingCallback();
    }
Ejemplo n.º 6
0
 void withGuiRow(ROW row, Action <DataGridRow> onGuiRow)
 {
     if (!rows.ContainsKey(row))
     {
         LogC.verbose(() => "discarding action on original thread for non-showing " + row); return;
     }
     QControl.runOnGuiThread(this, () => {
         DataGridRow guiRow;
         rows.TryGetValue(row, out guiRow);
         if (guiRow != null)
         {
             onGuiRow(guiRow);
         }
         else
         {
             LogC.verbose(() => "discarding action on gui thread for non showing" + row);
         }
     });
 }
Ejemplo n.º 7
0
        public void add(PlotDefinition plot)
        {
            var spud    = plot.spud;
            var count   = spud.count();
            var xPoints = new double[count];
            var yPoints = new double[count];

            Objects.zeroTo(count, i => {
                if (i >= bars.count())
                {
                    return;                                         // spud has more data than bars
                }
                xPoints[count - i - 1] = dateParent.index(bars[i].time);
                yPoints[count - i - 1] = spud[i];
            });
            var curve = AddCurve(plot.name, xPoints, yPoints, plot.color);

            curve.Symbol.IsVisible  = false;
            curve.IsOverrideOrdinal = true;
            spuds.Add(spud);
            names.Add(plot.name);

            var needsNewPoint = false;

            spud.pushedDown += () => needsNewPoint = true;
            spud.valueSet   += value => QControl.runOnGuiThread(dispatchTo, () => {
                var lastPoint = curve[curve.Points.Count - 1];
                if (needsNewPoint)
                {
                    curve.AddPoint(lastPoint.X + 1, value);
                }
                else
                {
                    lastPoint.Y = value;
                }
                BarSpudGraph.addSpudTo(Objects.first(parentTyped.dataTable().Rows), plot.name, value);
                needsNewPoint = false;
                parentTyped.Invalidate();
            });
            graphables.Add(new DoubleSpudGraphable(plot.name, spud, bars));
        }
Ejemplo n.º 8
0
    public override void AfterCardTargetingCallback()
    {
        foreach (GameObject tempGO in S.GameControlInst.TargetedCards)
        {
            Card tempCard = tempGO.GetComponent <Card>();

//			if(tempCard.CardAction == CardActionTypes.TargetCard) {
//				QControl.AddToQ(tempCard, QControl.QMethodType.Discard);
//			}

            QControl.AddToQ(tempCard, QControl.QMethodType.FreeActivate);
            QControl.AddToQ(tempCard, QControl.QMethodType.FreeActivate);

            if (tempCard.CardAction == CardActionTypes.TargetGridSquare)
            {
                QControl.AddToQ(tempCard, QControl.QMethodType.Discard);
            }
        }

        base.AfterCardTargetingCallback();
    }
Ejemplo n.º 9
0
    public void Punch(GameObject enemy)
    {
        //animation aspect. must happen first
        GridUnit enemyGU = enemy.GetComponent <GridUnit>();

        S.GridControlInst.MakeSquares(GridControl.TargetTypes.diamond, 0, 0, enemyGU.xPosition, enemyGU.yPosition, false);
        playerGU.PokeTowards(playerGU.AdjacentPosition(enemyGU));

        enemy.GetComponent <Enemy> ().GetPunched(punchDamage);
        S.GameControlInst.AddPlays(-1);

        //triggers
        EventControl.EventCheck("Punch");
        S.ShopControlInst.GoalCheck("Punch X times");
        if (Tutorial.TutorialLevel != 0)
        {
            S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialTrigger(3);
        }

        QControl.CheckQ();
    }
Ejemplo n.º 10
0
        public void addBars()
        {
            var spl = new StockPointList();

            Objects.each(bars.toArray(), bar => spl.Add(stockPoint(bar)));

            var myCurve = AddJapaneseCandleStick(symbol.name, spl);

            myCurve.Stick.IsAutoSize = true;
            myCurve.Stick.Color      = Color.Black;
            barsOnPlot            = true;
            XAxis.Scale.IsVisible = true;
            var graphable = new BarSpudGraphable(bars);

            graphables.Add(graphable);

            var needsNewBar = false;

            bars.pushedDown += () => {
                needsNewBar = true;
                QControl.runOnGuiThread(dispatchTo, () =>
                                        parentTyped.dataTable().addAtStart(parentTyped.dataTable().NewRow())
                                        );
            };
            bars.valueSet += bar => QControl.runOnGuiThread(dispatchTo, () => {
                if (needsNewBar)
                {
                    spl.Add(stockPoint(bar));
                    dateParent.setDate(bar.time, spl.Count);
                }
                else
                {
                    spl[spl.Count - 1] = stockPoint(bar);
                }
                BarSpudGraph.addBarTo(Objects.first(parentTyped.dataTable().Rows), bar);
                needsNewBar = false;
                parentTyped.Invalidate();
            });
        }
Ejemplo n.º 11
0
        public static int Main(string[] args)
        {
            QControl.forceLoad();
            Assembly q = null;

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (assembly.GetName().Name.Equals("Gui"))
                {
                    q = assembly;
                }
            }
            if (q == null)
            {
                throw Bomb.toss(
                          "Cannot find Gui.dll in assemblies:\n" + O.toShortString(O.convert(AppDomain.CurrentDomain.GetAssemblies(), a => a.FullName))
                          );
            }

            var appName   = args[0];
            var className = "Gui." + appName + ".MainWindow";

            try {
                var type    = q.GetType(className, true, false);
                var newArgs = new string[args.Length - 1];
                O.zeroTo(args.Length - 1, i => newArgs[i] = args[i + 1]);

                var application = new Application();
                System.Windows.Forms.Application.ThreadException += (s, e) => { DockingWindow.handleUncaughtException(e.Exception, appName); throw e.Exception; };
                var mainWindow = (Window)type.GetConstructor(new[] { typeof(string[]) }).Invoke(new[] { newArgs });
                mainWindow.Closed += (s, e) => Environment.Exit(0);
                application.Run(mainWindow);
            } catch (Exception e) {
                DockingWindow.handleUncaughtException(e, appName);
                return(-1);
            }
            return(0);
        }
Ejemplo n.º 12
0
 public void makeColor(ROW row, Brush color)
 {
     withGuiRow(row, guiRow => QControl.makeColor(this, guiRow, color));
 }
Ejemplo n.º 13
0
 public void ActuallyCheckQ()
 {
     QControl.CheckQ();
 }