Example #1
0
        static void Main(string[] args)
        {
            Settings.Load();
            BinanceWrapper synchronizer = new BinanceWrapper();

            BaseCommand.Do();
        }
Example #2
0
    public void Load()
    {
        FileFuncs.LoadFileOpen(fname);

        BaseCommand bc = new BaseCommand();

        //TheManager.TM.DestroyAll();
        for (int i = TheManager.TM.Thingies.Count - 1; i >= 0; --i)
        {
            bc.AddAction(new CDelete(TheManager.TM.Thingies[i]));
        }

        for (int i = FileFuncs.GetArrSize() - 1; i >= 0; --i)
        {
            DataStruct d = FileFuncs.ExtractElement(i);

            //Debug.Log(d.ObjectType);

            Thingy thing = PoolQueue.PQ.RequestThing((TypeOfThingy)d.ObjectType);

            bc.AddAction(new CSpawn(thing));

            bc.AddAction(new CMovement(thing, new Vector3(d.TransformData[0], d.TransformData[1], d.TransformData[2])));
            bc.AddAction(new CRotate(thing, Quaternion.Euler(d.TransformData[3], d.TransformData[4], d.TransformData[5])));
            bc.AddAction(new CScale(thing, new Vector3(d.TransformData[6], d.TransformData[7], d.TransformData[8])));

            //thing.transform.position = new Vector3(d.TransformData[0], d.TransformData[1], d.TransformData[2]);
            //thing.transform.rotation = Quaternion.Euler(d.TransformData[3], d.TransformData[4], d.TransformData[5]);
            //thing.transform.localScale = new Vector3(d.TransformData[6], d.TransformData[7], d.TransformData[8]);
        }

        bc.Do();

        FileFuncs.LoadFileClose();
    }
Example #3
0
    bool ButtonHasBeenClicked()
    {
        if (!Input.GetMouseButtonUp(TheManager.TM.LEFT_MOUSE))
        {
            return(true);
        }

        if (ButtonBool.AnyButtonClicked)
        {
            if (buttons.place.ButtonIsClicked)
            {
                if (dcf.spawnThingy != null && dcf.mLoc.mouseHit)
                {
                    BaseCommand create = new BaseCommand();
                    Thingy      thing  = PoolQueue.PQ.RequestThing(dcf.spawnThingy.tot);
                    create.AddAction(new CSpawn(thing));
                    create.AddAction(new CMovement(thing, dcf.mLoc.gizmoPseudoPos));
                    create.Do();
                    GoBack();
                    return(false);
                }
            }

            if (buttons.delete.ButtonIsClicked)
            {
                if (editee.Deletable())
                {
                    BaseCommand destroy = new BaseCommand();
                    destroy.AddAction(new CDelete(editee));
                    destroy.Do();
                    GoBack();
                    return(false);
                }
            }

            if (buttons.EnterMove.ButtonIsClicked)
            {
                EnablePosition ep = gameObject.AddComponent <EnablePosition>();
                DeactivateOnSwitch();
                ep.SetEnablePosition(dcf, this, dcf.modes.sPos.activeOnSwitch, editee, mf);

                return(false);
            }

            if (buttons.EnterRot.ButtonIsClicked)
            {
                EnableRotation ep = gameObject.AddComponent <EnableRotation>();
                DeactivateOnSwitch();
                ep.SetEnableRotation(dcf, this, dcf.modes.sRot.activeOnSwitch, editee, mf);

                return(false);
            }

            return(false);
        }

        return(true);
    }
    bool ButtonHasBeenClicked()
    {
        if (!Input.GetMouseButtonUp(TheManager.TM.LEFT_MOUSE))
        {
            return(true);
        }

        if (ButtonBool.AnyButtonClicked)
        {
            if (menuButtons.place.ButtonIsClicked)
            {
                if (dcf.spawnThingy != null && dcf.mLoc.mouseHit)
                {
                    BaseCommand create = new BaseCommand();
                    Thingy      thing  = PoolQueue.PQ.RequestThing(dcf.spawnThingy.tot);
                    create.AddAction(new CSpawn(thing));
                    create.AddAction(new CMovement(thing, dcf.mLoc.gizmoPseudoPos));
                    create.Do();
                    return(false);
                }
            }

            if (menuButtons.load.ButtonIsClicked)
            {
                FileLoad fs = new FileLoad("SaveFile");
                fs.Load();
                return(false);
            }

            if (menuButtons.save.ButtonIsClicked)
            {
                FileSave fs = new FileSave("SaveFile");
                fs.Save();
                return(false);
            }

            return(false);
        }

        return(true);
    }
Example #5
0
    public override bool PseudoUpdate()
    {
        if (!CheckAboutActivity())
        {
            return(false);
        }

        if (ButtonBool.AnyButtonClicked)
        {
            return(false);
        }

        editee.transform.localRotation = startRot;

        if (Input.GetMouseButtonUp(TheManager.TM.LEFT_MOUSE))
        {
            BaseCommand command = new BaseCommand();
            command.AddAction(new CRotate(editee, finalRotation));
            command.Do();
            GoBack();

            return(false);
        }

        if (Input.GetMouseButtonUp(TheManager.TM.RIGHT_MOUSE))
        {
            GoBack();
            return(false);
        }

        float sin = Mathf.Asin(Vector3.Dot(Vector3.Cross((mPosInitial - objectOnScreen).normalized, (Input.mousePosition - objectOnScreen).normalized), Vector3.forward)) * Mathf.Rad2Deg;

        sin = Vector3.Dot((Input.mousePosition - objectOnScreen), (mPosInitial - objectOnScreen)) > 0 ? sin : 180f - sin;

        finalRotation = startRot;
        Quaternion qTemp = dcf.worldCam.transform.rotation;

        finalRotation = qTemp * Quaternion.Euler(0, 0, sin) * Quaternion.Inverse(qTemp) * finalRotation;

        return(base.PseudoUpdate());
    }
Example #6
0
    public override bool PseudoUpdate()
    {
        if (!CheckAboutActivity())
        {
            return(false);
        }

        if (ButtonBool.AnyButtonClicked)
        {
            return(false);
        }

        editee.transform.localPosition = startPos;

        if (Input.GetMouseButtonUp(TheManager.TM.LEFT_MOUSE))
        {
            BaseCommand command = new BaseCommand();
            command.AddAction(new CMovement(editee, finalPosition));
            command.Do();
            GoBack();

            return(false);
        }

        if (Input.GetMouseButtonUp(TheManager.TM.RIGHT_MOUSE))
        {
            GoBack();
            return(false);
        }

        finalPosition = dcf.worldCam.ScreenPointToRay(Input.mousePosition).direction;
        finalPosition = finalPosition * dist / Vector3.Dot(finalPosition, dcf.worldCam.transform.forward) + dcf.worldCam.transform.position;
        //Debug.Log(finalPosition);

        return(base.PseudoUpdate());
    }
Example #7
0
        static void Main(string[] args)
        {
            Settings.Load();
            ConnectionServer server = new ConnectionServer();


            server.Client.FrameRecieved += Client_FrameRecieved;

            dps.JBVClient = server.Client;

            BaseCommand.Register("Devices", (args) =>
            {
                Frame f = Frame.RequestSID(SoftwareID.Unknown);
                server.Client.SendFrame(f);
            });


            BaseCommand.Register("Led", (args) =>
            {
                dps.SetLED(args[1] == "1");
            });

            BaseCommand.Do();
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="command"></param>
 /// <param name="record">是否记录操作</param>
 public void DoCommand(BaseCommand command, bool record = true)
 {
     command.Do();
     if (record) CommandList.Add(command);
 }