protected override void OnPaint(PaintEventArgs e)
        {
            SuspendLayout();

            e.Graphics.FillRectangle(Brushes.LightGray, new RectangleF(0, e.ClipRectangle.Height - Timebar.Height, Width, Timebar.Height));

            for (int i = 0; i < Width; i++)
            {
                e.Graphics.DrawLine(Pens.Black, IndexToPosition(i), e.ClipRectangle.Height - Timebar.Height, IndexToPosition(i), e.ClipRectangle.Height);

                var span = ((double)i / (double)Timebar.GetLevel(Timebar.Scale)).ToString();

                e.Graphics.DrawString(span, DefaultFont, Brushes.Black,
                                      IndexToPosition(i) - Convert.ToInt32(e.Graphics.MeasureString(i.ToString(), DefaultFont).Width / 2),
                                      e.ClipRectangle.Height - Timebar.Height - 15);

                for (int j = 1; j < SPACER; j++)
                {
                    int start_w = IndexToPosition(i);

                    e.Graphics.DrawLine(Pens.DarkGray, start_w + SPACER_TICK * j, e.ClipRectangle.Height - Timebar.Height,
                                        start_w + SPACER_TICK * j, e.ClipRectangle.Height);
                }
            }

            if (_Index > -1)
            {
                e.Graphics.FillRectangle(SystemBrushes.Highlight, IndexToRectangle(_Index));
            }

            base.OnPaint(e);

            ResumeLayout();
        }
Exemple #2
0
    void Start()
    {
        myTimebar = this;

        //float型からint型へCastし、String型に変換して表示
        //GetComponent<Text>().text = ((int)time).ToString();

        //Invoke("DelayMethod", 3.0f);//フレームカウント
    }
Exemple #3
0
        private void AddVolumeData(Timebar timebar)
        {
            DateTime x_axis = EPOCH.AddSeconds(timebar.Timestamp).ToLocalTime();

            if (timebar.Open <= timebar.Close)
            {
                series3.Points.AddXY(x_axis, (timebar.BuyQty + timebar.SellQty + timebar.UnknQty));
            }
            else
            {
                series4.Points.AddXY(x_axis, (timebar.BuyQty + timebar.SellQty + timebar.UnknQty));
            }

            //
            //  Add VWAP data
            //

            aggregate_qty += (timebar.BuyQty + timebar.SellQty + timebar.UnknQty);
            aggregate_val += (timebar.BuyVal + timebar.SellVal + timebar.UnknVal);
            series10.Points.AddXY(x_axis, (aggregate_val / aggregate_qty));

            double    totalVolume = 0;
            ArrayList volumeList  = new ArrayList();

            foreach (DataPoint point in series3.Points)
            {
                totalVolume += point.YValues[0];
                volumeList.Add(point.YValues[0]);

                if (point.ToolTip == null || point.ToolTip == "")
                {
                    point.ToolTip = "BUY: " + timebar.BuyQty + "\nSELL: " + timebar.SellQty + "\nTOTAL: " + point.YValues[0];
                }
            }

            foreach (DataPoint point in series4.Points)
            {
                totalVolume += point.YValues[0];
                volumeList.Add(point.YValues[0]);

                if (point.ToolTip == null || point.ToolTip == "")
                {
                    point.ToolTip = "BUY: " + timebar.BuyQty + "\nSELL: " + timebar.SellQty + "\nTOTAL: " + point.YValues[0];
                }
            }

/*
 *          //
 *          //  Calculate the 70% median
 *          //
 *
 *          volumeList.Sort( );
 *          double median = (double)volumeList[ (int)( (volumeList.Count-1) * .7) ];
 */
        }
        public void RefreshControls()
        {
            foreach (Control item in Controls)
            {
                if (item.Tag == null)
                {
                    item.Tag = item.Width;
                }

                item.Width = (int)item.Tag * Timebar.GetLevel(Timebar.Scale);
            }
        }
    void Start()
    {
        lvm         = gameObject.GetComponent <LevelManager> ();
        sm          = gameObject.GetComponent <ScreenManager> ();
        num_players = GameManager.Instance.GetNumPlayer();
        timebar     = GameObject.Find("Timebar").GetComponent <Timebar> ();
        seconds     = START_SEC;
        //init points
        points = new int[num_players];
        times  = new float[num_players];

        for (int i = 0; i < num_players; i++)
        {
            points [i] = 0;
            times [i]  = 0;
        }

        lvm.OnStart  += StartTimer;
        lvm.OnFinish += FindWinners;
    }
    /// <summary>
    /// ゲームの初期設定
    /// </summary>
    void GameInitiarize()
    {
        //マップチップのロード
        FindObjectOfType <ResourceLoader>().LoadAll();

        //デバッグに何か入ってたら優先する
        if (debug_loadStage != "")
        {
            string[] bff = debug_loadStage.Split('-');
            stageLevel = int.Parse(bff[0]);
            stageNum   = int.Parse(bff[1]);
        }

        //ステージの生成
        StageData stageData;

        if (IsEditMode)
        {
            stageData      = editModeMain.GenerateStageData();
            stageText.text = "Preview edit map";
        }
        else
        {
            stageData      = CsvLoader.StageLoad(stageLevel, stageNum);
            stageText.text = string.Format("{0} F  -  R o o m  {1}", stageLevel, stageNum);
        }
        StageGenerator.GenerateMap(stageData.mapData);

        //制限時間の設定
        Timebar.StopTimer();
        Timebar.Decpersec = 1;
        Timebar.time      = stageData.time;

        //音楽を再生
        AudioManager.FadeIn(2.0f, BGMType.Game, 1, true);

        //入力の許可
        InputManager.isFreeze = false;
        //メニューを開けるようにする
        UImanager.isFreeze = false;
    }
Exemple #7
0
        private void AddTimebarData(Timebar timebar)
        {
            DateTime x_axis = EPOCH.AddSeconds(timebar.Timestamp).ToLocalTime();

            series1.Points.AddXY(x_axis, new object[] {
                timebar.High,
                timebar.Low,
                timebar.Open,
                timebar.Close
            });

            foreach (DataPoint point in series1.Points)
            {
                if (point.ToolTip == null || point.ToolTip == "")
                {
                    point.ToolTip = "OPEN: " + point.YValues[2] +
                                    "\nHIGH: " + point.YValues[0] +
                                    "\nLOW: " + point.YValues[1] +
                                    "\nCLOSE: " + point.YValues[3];
                }
            }

            currXAxis = x_axis;
        }
Exemple #8
0
    public IEnumerator DestroyBombAnim()
    {
        //ステージクリア
        GameManager.GameClear();

        //落ちる音再生
        AudioManager.Play(SEType.Hole, 1.0f);

        //カウントダウンストップ
        Timebar.StopTimer();

        float rotSpeed  = 5;
        float timeSpeed = 1;
        float t         = 0;

        while (t < 1.0f)
        {
            t += Time.deltaTime * timeSpeed;

            Vector3    scale = new Vector3(1, 1, 1) * (1 - t);
            Quaternion rot   = Quaternion.AngleAxis(rotSpeed, Vector3.forward);

            transform.localScale            = scale;
            timeViewer.transform.localScale = scale;

            transform.rotation            *= rot;
            timeViewer.transform.rotation *= rot;

            yield return(null);
        }

        //パーティクル再生
        ParticleManager.PlayOneShot(ParticleType.BombDestrtoy, transform.position, Quaternion.identity, 5);

        Destroy(gameObject);
    }
Exemple #9
0
        public void UpdateTimebarData(Timebar timebar, bool finalTimebar)
        {
            DateTime x_axis = EPOCH.AddSeconds(timebar.Timestamp).ToLocalTime();

            if (deleteLastTimebar == true)
            {
                series1.Points.RemoveAt(series1.Points.Count - 1);
                deleteLastTimebar = false;
            }

            //
            //  Determine if there are any executions to add to the timebar chart that
            //  were created prior to the current timebar.
            //

            if (orderExecutionList.Count > 0)
            {
                //
                //  First, create copy of execution list
                //

                ArrayList skip_list = new ArrayList(orderExecutionList);

                foreach (OrderExecution orderExecution in skip_list)
                {
                    if (AddOrderExecutionData(orderExecution, false))
                    {
                        //
                        //  We were able to insert the execution. Remove it from
                        //  the order execution list.
                        //

                        orderExecutionList.Remove(orderExecution);
                    }
                }

                skip_list.Clear();
            }

            if (finalTimebar == false && series1.Points.Count > 0)
            {
                if (x_axis == currXAxis)
                {
                    DataPoint candlestick = series1.Points[series1.Points.Count - 1];
                    DataPoint volume      = series5.Points[0];

                    candlestick.YValues[0] = timebar.High;
                    candlestick.YValues[1] = timebar.Low;
                    candlestick.YValues[2] = timebar.Open;
                    candlestick.YValues[3] = timebar.Close;

                    candlestick.ToolTip = "OPEN: " + candlestick.YValues[2] +
                                          "\nHIGH: " + candlestick.YValues[0] +
                                          "\nLOW: " + candlestick.YValues[1] +
                                          "\nCLOSE: " + candlestick.YValues[3];

                    if (chartArea1.AxisY.Maximum != Double.NaN &&
                        chartArea1.AxisY.Maximum <= timebar.High)
                    {
                        //log.Warn( " MAX: " + chartArea1.AxisY.Maximum + " <= " + timebar.High );

                        deleteLastTimebar = true;
                        series1.Points.AddXY(EPOCH.AddSeconds(timebar.Timestamp).ToLocalTime(),
                                             new object[] {
                            timebar.High,
                            timebar.Low,
                            timebar.Open,
                            timebar.Close
                        });
                    }

                    if (chartArea1.AxisY.Minimum != Double.NaN &&
                        chartArea1.AxisY.Minimum >= timebar.Low)
                    {
                        //log.Info( " MIN: " + chartArea1.AxisY.Minimum + " >= " + timebar.Low );

                        deleteLastTimebar = true;
                        series1.Points.AddXY(EPOCH.AddSeconds(timebar.Timestamp).ToLocalTime(),
                                             new object[] {
                            timebar.High,
                            timebar.Low,
                            timebar.Open,
                            timebar.Close
                        });
                    }

                    volume.YValues[0] = (timebar.BuyQty + timebar.SellQty + timebar.UnknQty);

                    if (chartArea2.AxisY.Maximum != Double.NaN &&
                        chartArea2.AxisY.Maximum <= volume.YValues[0])
                    {
                        //log.Warn( " VOL: " + chartArea2.AxisY.Maximum + " <= " + volume.YValues[ 0 ] );
                        RemovePlaceholderVolumeData( );
                        AddPlaceholderVolumeData(timebar);
                    }
                }
                else if (timebar.Open > 0)
                {
                    AddTimebarData(timebar);
                    AddPlaceholderVolumeData(timebar);
                }
            }
            else if (finalTimebar == true && series1.Points.Count > 0)
            {
                if (x_axis == currXAxis)
                {
                    RemovePlaceholderVolumeData( );
                    AddVolumeData(timebar);

                    DataPoint candlestick = series1.Points[series1.Points.Count - 1];
                    candlestick.YValues[0] = timebar.High;
                    candlestick.YValues[1] = timebar.Low;
                    candlestick.YValues[2] = timebar.Open;
                    candlestick.YValues[3] = timebar.Close;

                    candlestick.ToolTip = "OPEN: " + candlestick.YValues[2] +
                                          "\nHIGH: " + candlestick.YValues[0] +
                                          "\nLOW: " + candlestick.YValues[1] +
                                          "\nCLOSE: " + candlestick.YValues[3] +
                                          "\nVWAP: " + (aggregate_val / aggregate_qty).ToString("0.000");
                }
                else
                {
                    AddTimebarData(timebar);
                    AddVolumeData(timebar);
                }
            }
            else if (finalTimebar == true && series1.Points.Count == 0)
            {
                AddTimebarData(timebar);
                AddVolumeData(timebar);
            }
        }
Exemple #10
0
        private void AddPlaceholderVolumeData(Timebar timebar)
        {
            DateTime x_axis = EPOCH.AddSeconds(timebar.Timestamp).ToLocalTime();

            series5.Points.AddXY(x_axis, (timebar.BuyQty + timebar.SellQty + timebar.UnknQty));
        }
Exemple #11
0
 /// <summary>
 /// ゲームを開始する
 /// </summary>
 public static void GameStart()
 {
     //カウントダウン開始
     Timebar.StartTimer();
 }
Exemple #12
0
 public void TestStopTimer()
 {
     Timebar.StopTimer();//タイムストップ
 }
Exemple #13
0
 public void TestStartTimer()
 {
     Timebar.StartTimer();//タイム起動
 }