Esempio n. 1
0
 public BoxData(BoxData d)
 {
     Highest   = d.Highest;
     LeftMost  = d.LeftMost;
     Rightmost = d.Rightmost;
     Lowest    = d.Lowest;
 }
Esempio n. 2
0
        private void miBoxData_Click(object sender, System.EventArgs e)
        {
            GetDatafile msg = new GetDatafile();

            Pandora.Profile.Server.FillBoxMessage(msg);
            msg.DataType = BoxDatafile.BoxData;

            BoxServerForm form = new BoxServerForm(msg);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ReturnDatafile data = form.Response as ReturnDatafile;

                if (data != null)
                {
                    BoxData bdata = data.Data as BoxData;

                    if (bdata != null)
                    {
                        Pandora.BoxData = bdata;
                        Pandora.BoxForm.UpdateBoxData();
                        Pandora.BoxData.Save();
                    }
                }
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void SetPixels(float[,] pValues, int pWidth, int pHeight)
        {
            int x = (Width - pWidth) / 2 + 1;
            int y = (Height - pHeight) / 2;

            for (int xi = 0; xi < Width; ++xi)
            {
                for (int yi = 0; yi < Height; ++yi)
                {
                    BoxData boxData = vBoxes[xi, yi];

                    if (xi < x || xi >= x + pWidth || yi < y || yi >= y + pHeight)
                    {
                        boxData.TargVal = 0;
                        boxData.Delay   = 0;
                    }
                    else
                    {
                        float val = pValues[xi - x, pHeight - (yi - y) - 1];
                        boxData.TargVal = Math.Min(1, val * 1.1f);
                        boxData.Delay   = yi - y;
                    }
                }
            }

            vIsAnimating = true;
        }
    public void AddBox(BoxData boxData)
    {
        string json = JsonUtility.ToJson(boxData);

        Firebase.Database.DatabaseReference dbRef = Firebase.Database.FirebaseDatabase.DefaultInstance.RootReference;
        dbRef.Child("users").Push().SetRawJsonValueAsync(json);
    }
    private void InitializeBoxDataBuffer()
    {
        int boxesCount = m_boxLength * m_boxLength * m_boxLength;

        BoxData[] boxDatas  = new BoxData[boxesCount];
        float     startPosX = m_boxCenter.x - m_boxLength * m_boxScale / 2.0f + m_boxScale / 2.0f;
        float     startPosY = m_boxCenter.y - m_boxLength * m_boxScale / 2.0f + m_boxScale / 2.0f;
        float     startPosZ = m_boxCenter.z - m_boxLength * m_boxScale / 2.0f + m_boxScale / 2.0f;

        for (int i = 0; i < m_boxLength; ++i)
        {
            for (int j = 0; j < m_boxLength; ++j)
            {
                for (int k = 0; k < m_boxLength; ++k)
                {
                    int index = i * m_boxLength * m_boxLength + j * m_boxLength + k;
                    boxDatas[index].position  = new Vector3(startPosX + i * m_boxScale, startPosY + j * m_boxScale, startPosZ + k * m_boxScale);
                    boxDatas[index].direction = Vector3.zero;
                }
            }
        }

        m_boxDataBuffer = new ComputeBuffer(boxesCount, Marshal.SizeOf(typeof(BoxData)));
        m_boxDataBuffer.SetData(boxDatas);
        m_material.SetBuffer("_BoxDataBuffer", m_boxDataBuffer);
    }
Esempio n. 6
0
        private static BoxData[] ReadBoxData(BinaryData s)
        {
            var spBoxes = new List <BoxData>();

            for (int i = 1, loopTo = s.ReadInt16(); i <= loopTo; i++)
            {
                var   wb   = new BoxData();
                short type = s.ReadInt16();
                if (type < 0) // Compatibility with old buggy RM versions
                {
                    if (type < 0x32)
                    {
                        type = 0;
                    }
                    else if (type > 0x33)
                    {
                        type = 0x33;
                    }
                }
                wb.Type = (BoxDataType)type;
                wb.X1   = s.ReadInt16();
                wb.Z1   = s.ReadInt16();
                wb.X2   = s.ReadInt16();
                wb.Z2   = s.ReadInt16();
                wb.Y    = s.ReadInt16();
                spBoxes.Add(wb);
            }

            return(spBoxes.ToArray());
        }
Esempio n. 7
0
        public ActionResult HeikinAshi()
        {
            var model = BoxData.GetDataFromJson();

            ViewBag.DemoSettingsModel = new ClientSettingsModel();
            ViewBag.ChartType         = C1.Web.Mvc.Finance.ChartType.HeikinAshi;
            return(View(model));
        }
 [Command] void cmdPickUp(GameObject obj)
 {
     box = obj;
     box.GetComponent <NetworkIdentity>().AssignClientAuthority(connectionToClient);
     boxData        = box.GetComponent <BoxData>();
     boxData.Parent = gameObject;
     boxData.player = PlayerName;
 }
Esempio n. 9
0
    public static List <Rect> LoadSceneBoxData()
    {
        string  config = File.ReadAllText(s_OutputPath);
        BoxData data   = new BoxData();

        data = JsonUtility.FromJson <BoxData>(config);
        return(data.m_SceneRects);
    }
Esempio n. 10
0
    public void PutBoxArray(Entity owner, Box[] boxes)
    {
        if (boxes.Length == 0)
        {
            return;
        }

        ownerBoxDict[owner] = new BoxData(boxes);
    }
Esempio n. 11
0
    /// <summary>
    /// Загрузить данные о коробке
    /// </summary>
    public void SetData(InterObjData _intObjData)
    {
        BoxData bData = (BoxData)_intObjData;

        if (bData != null)
        {
            health = bData.health;
        }
    }
Esempio n. 12
0
        public ActionResult Markers()
        {
            var model = BoxData.GetDataFromJson().GetRange(0, 20);

            ViewBag.DemoSettingsModel = new ClientSettingsModel()
            {
                Settings = CreateMarkersSettings()
            };
            return(View(model));
        }
        public ActionResult ColumnVolume()
        {
            var model = BoxData.GetDataFromJson();

            ViewBag.DemoSettingsModel = new ClientSettingsModel()
            {
            };
            ViewBag.ChartType = C1.Web.Mvc.Finance.ChartType.ColumnVolume;
            return(View(model));
        }
        public ActionResult FibonacciTool()
        {
            var model = BoxData.GetDataFromJson();

            ViewBag.DemoSettingsModel = new ClientSettingsModel()
            {
                Settings = CreateFibonacciToolSettings()
            };
            return(View(model));
        }
        public ActionResult RangeSelector()
        {
            var model = BoxData.GetDataFromJson();

            ViewBag.DemoSettingsModel = new ClientSettingsModel()
            {
            };
            ViewBag.ChartType = C1.Web.Mvc.Finance.ChartType.Candlestick;
            return(View(model));
        }
Esempio n. 16
0
 public void OnReceived(Socket socket, BoxData outBox, bool normal)
 {
     lock (this)
     {
         if (list != null)
         {
             list.Add(outBox);
         }
     }
 }
        public ActionResult TrendLine()
        {
            var model = BoxData.GetDataFromJson();

            ViewBag.DemoSettingsModel = new ClientSettingsModel()
            {
                Settings = CreateTrendLineSettings()
            };
            return(View(model));
        }
    public static void ShowPopup(BoxData data, Texture2D photo, Action onDetailsClosedCallback)
    {
        EventData e = new EventData("OnShowPopupWindowEvent");

        e.Data["Type"]          = typeof(BoxDetailsPopupWindow);
        e.Data["Data"]          = data;
        e.Data["Photo"]         = photo;
        e.Data["CloseCallback"] = onDetailsClosedCallback;
        AppManager.Instance.EventManager.CallOnShowPopupWindowEvent(e);
    }
        public ActionResult EventAnnotations()
        {
            var model = BoxData.GetDataFromJson();

            ViewBag.DemoSettingsModel = new ClientSettingsModel()
            {
            };
            ViewBag.Tooltips  = BoxData.GetAnnotationTooltips();
            ViewBag.ChartType = C1.Web.Mvc.Finance.ChartType.Candlestick;
            return(View(model));
        }
Esempio n. 20
0
        public override void UpdateStateValue(BoxData newState)
        {
            StopBlink();

            switch (newState._state)
            {
            case BlackBox.GuessNoneState:
                this.image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                this.imageForeground.Source = null;
                break;

            case BlackBox.GuessingState:
                this.image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                this.imageForeground.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessing);
                this.imageForeground.Opacity = 0.0;
                timer.Start();
                break;

            case BlackBox.GuessFailedState:
                this.image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                this.imageForeground.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessFailed);
                this.imageForeground.Opacity = 0.0;
                timer.Start();
                if (!this.LayoutRoot.Children.Contains(_starEffectPane))
                {
                    this.LayoutRoot.Children.Add(_starEffectPane);
                }
                _starEffectPane.Start(StarEffectPane.StarEffectType.RedStar);
                break;

            case BlackBox.GuessedState:
                this.image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                this.imageForeground.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessed);
                this.imageForeground.Opacity = 0.0;
                timer.Start();
                if (!this.LayoutRoot.Children.Contains(_starEffectPane))
                {
                    this.LayoutRoot.Children.Add(_starEffectPane);
                }
                _starEffectPane.Start(StarEffectPane.StarEffectType.YellowStar);
                break;

            default:
                break;
            }
        }
Esempio n. 21
0
 public BoxData[] GetBoxDataAndClear()
 {
     lock (qBuffer)
     {
         List <BoxData> list = new List <BoxData>();
         foreach (var p in qBuffer)
         {
             list.Add(BoxData.Create(p.OutBox));
         }
         qBuffer.Clear();
         return(list.ToArray());
     }
 }
Esempio n. 22
0
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        {
            // get plane
            var rc = RhinoGet.GetPlane(out var plane);

            if (rc != Result.Success)
            {
                return(rc);
            }

            // get length
            double length = 0;

            rc = RhinoGet.GetNumber("Specify length", false, ref length, 0.1, 1000000);
            if (rc != Result.Success)
            {
                return(rc);
            }


            // get width
            double width = 0;

            rc = RhinoGet.GetNumber("Specify width", false, ref width, 0.1, 1000000);
            if (rc != Result.Success)
            {
                return(rc);
            }

            // get height
            double height = 0;

            rc = RhinoGet.GetNumber("Specify height", false, ref height, 0.1, 1000000);
            if (rc != Result.Success)
            {
                return(rc);
            }

            // create rectangleData
            var data = new BoxData(plane, length, width, height);
            // and sphere object
            var boxObject = data.CreateCustomObject();

            // add sphereObject to doc
            doc.Objects.AddRhinoObject(boxObject);

            //redraw views
            doc.Views.Redraw();
            // return success
            return(Result.Success);
        }
Esempio n. 23
0
        private GameObject[] CaptureHitsBox()
        {
            int     predictions    = 1;
            BoxData currentBoxData = new BoxData(
                this.transform.TransformPoint(this.boxCenter),
                this.transform.rotation
                );

            this.boxInterframeCaptures[0] = currentBoxData;
            bool hasPreviousCapture = Time.frameCount <= this.prevCaptureFrame + 1;

            if (hasPreviousCapture)
            {
                predictions = this.boxInterframePredictions;
                for (int i = 0; i < predictions; ++i)
                {
                    float t = ((float)(i + 1f)) / ((float)predictions);
                    this.boxInterframeCaptures[i] = new BoxData(
                        Vector3.Lerp(currentBoxData.center, this.prevBoxBounds.center, t),
                        Quaternion.Lerp(currentBoxData.rotation, this.prevBoxBounds.rotation, t)
                        );
                }
            }

            this.prevBoxBounds = currentBoxData;
            List <GameObject> candidates = new List <GameObject>();

            for (int i = 0; i < boxInterframeCaptures.Length; ++i)
            {
                int numCollisions = Physics.OverlapBoxNonAlloc(
                    this.boxInterframeCaptures[i].center,
                    this.boxSize / 2f,
                    this.bufferColliders,
                    this.boxInterframeCaptures[i].rotation,
                    this.layerMask,
                    QueryTriggerInteraction.Ignore
                    );

                for (int j = 0; j < numCollisions; ++j)
                {
                    GameObject target = this.bufferColliders[j].gameObject;
                    if (!candidates.Contains(target))
                    {
                        candidates.Add(target);
                    }
                }
            }

            return(candidates.ToArray());
        }
Esempio n. 24
0
    public CollectionData(string ownerSet)
    {
        owner = ownerSet;
        boxes = new List <BoxData>();

        //create at least 2 boxes, so this field will be treated as array
        for (int i = 1; i <= 2; i++)
        {
            BoxData box = new BoxData();
            box.box_index = i;
            box.photo_url = BoxData.EMPTY_PHOTO_URL;
            boxes.Add(box);
        }
    }
Esempio n. 25
0
 public void OnReceived(Socket socket, BoxData outBox, bool normal)
 {
     if (socket.DestAddress == long.MaxValue)
     {
         // default replicate address
         return;
     }
     lock (Packages)
     {
         Packages.Add(new Package {
             Socket = socket, OutBox = outBox.ToBytes()
         });
     }
 }
        public void HandlePhysics()
        {
            foreach (Entity entity in Entities)
            {
                Componets.Transform transform = entity.GetComponent <Componets.Transform>();
                Physics             physics   = entity.GetComponent <Physics>();

                transform.Position += physics.Velocity;

                // Check Collision
                if (entity.HasComponent <BoxCollision>())
                {
                    BoxCollision boxCollision = entity.GetComponent <BoxCollision>();

                    IBox collidedBox = null;

                    foreach (IBox box in boxCollision.Boxes)
                    {
                        BoxData data = (BoxData)box.Data;
                        var     move = box.Move(transform.Position.X + data.Position.X * transform.Scale.X,
                                                transform.Position.Y + data.Position.Y * transform.Scale.Y,
                                                (collision) =>
                        {
                            if (!collision.Other.HasTag(data.Layer))
                            {
                                if (!data.TriggerOnly)
                                {
                                    collidedBox = box;
                                    return(CollisionResponses.Slide);
                                }
                                else
                                {
                                    // Trigger Collision
                                    return(CollisionResponses.Cross);
                                }
                            }

                            return(CollisionResponses.None);
                        });
                    }

                    if (collidedBox != null)
                    {
                        BoxData boxData = (BoxData)collidedBox.Data;
                        transform.Position = new Vector(collidedBox.X - transform.Scale.X * boxData.Position.X, collidedBox.Y - transform.Scale.Y * boxData.Position.Y);
                    }
                }
            }
        }
Esempio n. 27
0
        public override void UpdateStateValue(BoxData newState)
        {
            StopBlink();

            switch (newState._state)
            {
                case BlackBox.GuessNoneState:
                    this.image.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                    this.imageForeground.Source = null;
                    break;
                case BlackBox.GuessingState:
                    this.image.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                    this.imageForeground.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessing);
                    this.imageForeground.Opacity = 0.0;
                    timer.Start();
                    break;
                case BlackBox.GuessFailedState:
                    this.image.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                    this.imageForeground.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessFailed);
                    this.imageForeground.Opacity = 0.0;
                    timer.Start();
                    if (!this.LayoutRoot.Children.Contains(_starEffectPane))
                    {
                        this.LayoutRoot.Children.Add(_starEffectPane);
                    }
                    _starEffectPane.Start(StarEffectPane.StarEffectType.RedStar);
                    break;
                case BlackBox.GuessedState:
                    this.image.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessNone);
                    this.imageForeground.Source =
                        BlackboxImageUtils.Image(BlackboxImageType.BlackBoxGuessed);
                    this.imageForeground.Opacity = 0.0;
                    timer.Start();
                    if (!this.LayoutRoot.Children.Contains(_starEffectPane))
                    {
                        this.LayoutRoot.Children.Add(_starEffectPane);
                    }
                    _starEffectPane.Start(StarEffectPane.StarEffectType.YellowStar);
                    break;
                default:
                    break;
            }
        }
Esempio n. 28
0
    public void InitWithData(BoxData data)
    {
        _data           = data;
        NumberText.text = data.box_index.ToString("D4");
        Texture2D photoFromCache = AppManager.Instance.PhotoCache.LoadPhotoFromCache(data.box_index, data.photo_date);

        if (photoFromCache != null)
        {
            SetPhotoTexture(photoFromCache);
        }
        else
        {
            StartCoroutine(LoadPhotoCo(data.photo_url));
        }
    }
 private void OnCollisionEnter(Collision other)
 {
     if (boxData != null)
     {
         boxData.boxHealth -= other.relativeVelocity.magnitude * boxData.boxFragility * damageScale;
     }
     if (other.collider.tag == "DeliveryPlatform" && boxData != null)
     {
         float value = boxData.boxHealth / 100.0f;
         value = Mathf.Clamp(value, 0, 1);
         CmdDestroyBox(boxData.gameObject, (int)value);
         boxData = null;
         boxHealthPanel.gameObject.SetActive(false);
     }
 }
Esempio n. 30
0
    public static void OutputSceneBoxData(List <Rect> rects)
    {
        BoxData data = new BoxData();

        data.m_SceneRects = rects;

        string jsonContent = JsonUtility.ToJson(data, true);

        if (!File.Exists(s_OutputPath))
        {
            File.Create(s_OutputPath);
        }
        File.WriteAllText(s_OutputPath, jsonContent);
        Debug.Log("输出完毕");
    }
        public void Delete()
        {
            FinishMouseEvent();
            var frame = _Editor.CurrentFrame;

            if (frame != null)
            {
                var list = _SelectedMultiple.Select(b => b.Index).OrderBy(i => - i).ToArray();
                //remove in reversed order
                foreach (var i in list)
                {
                    GetBoxListFromFrame(frame).RemoveAt(i);
                }
            }
            ClearSelected();
            BoxData.ResetDataList();
        }
Esempio n. 32
0
 public override void UpdateStateValue(BoxData newState)
 {
     // no state need to update
 }
	public void FreshUI(){
		if(chapter == null){
			Debug.LogError("[UIRewardController] the data is null");
			return;
		}
		ChapterStruct.Award award = chapter.award;
		labelStarPercentage.text = award.totalCurrentStars + "/" + award.totalChapterStars;
		progressBar.value = (float)award.totalCurrentStars/(float)award.totalChapterStars;
		
		int perStar = award.totalChapterStars/4;
		
		for(int i = 0 ; i < 4 ; i ++){
			var boxScript = (UIAwardBox)boxes[i].GetComponent(typeof(UIAwardBox));
			boxScript.FreshUI(boxDates[i]);
		}
		if(!award.Box1){
			currentBox = boxDates[0];
		}else if(award.Box1 && !award.Box2){
			currentBox = boxDates[1];
		}else if(award.Box2 && !award.Box3){
			currentBox = boxDates[2];
		}else if(award.Box3 && !award.Box4){
			currentBox = boxDates[3];
		}else
			currentBox = boxDates[3];
		FreshAwardPanel();
	}