void Start()
    {
        // ...............................................
        // Coroutine adaptor initialization
        CoRoutineUtils.StartCoroutine = StartCoroutine;
        WaitForFixedUpdate wait = new WaitForFixedUpdate();

        CoRoutineUtils.WaitForFixedUpdate = delegate() { return(wait); };
        CoRoutineUtils.WaitForSeconds     = delegate(double delay) { return(new WaitForSeconds((float)delay)); };

        Component[] windows = gameObject.GetComponents(typeof(BitWindow));
        BitWindow   window  = null;

        for (int i = 0; i < windows.Length; i++)
        {
            if (windows[i].name == "coloranimator_window")
            {
                window = (BitWindow)windows[i];
                break;
            }
        }

        if (window == null)
        {
            Debug.LogError("Main window not found.");
            return;
        }

        Debug.Log("Main window loaded. =)");

        BitHorizontalProgressBar animatorHorizontalprogressbar = window.FindControl <BitHorizontalProgressBar>("animator_horizontalprogressbar");

        CoRoutineUtils.StartCoroutine(animatorHorizontalprogressbar.AnimateProgress(animatorHorizontalprogressbar.MinValue, animatorHorizontalprogressbar.MaxValue, 5));
    }
예제 #2
0
    private void StartNewGameWindowComponents(BitWindow window)
    {
        var accessor = new NewgameWindowGuiAcessor(window);

        accessor.StartButton.Enabled = false;

        accessor.NameTextfield.TextChanged +=
            (sender, e) =>
        {
            if (string.IsNullOrEmpty(accessor.NameTextfield.Text))
            {
                accessor.StartButton.Enabled = false;
                return;
            }

            _playerName = accessor.NameTextfield.Text;
            accessor.StartButton.Enabled = true;
        };

        accessor.BackButton.MouseClick +=
            (sender, e) =>
        {
            UnloadWindow(NewGamePrefab);
            StartMainWindowComponents(OpenWindow(MainMenuPrefab));
        };

        accessor.StartButton.MouseClick +=
            (sender, e) =>
        {
            _player = new Player(_playerName, BalanceDefault);
            UnloadWindow(NewGamePrefab);
            StartGameWindows();
        };
    }
 public void Dispose()
 {
     MainmenuWindowValue = null;
     _1MainPictureValue  = null;
     NewgameButtonValue  = null;
     OptionsButtonValue  = null;
     ExitButtonValue     = null;
 }
 public void Dispose()
 {
     TopWindowValue          = null;
     MarketButtonValue       = null;
     PlayernameLabelValue    = null;
     DepotButtonValue        = null;
     PlayerbalanceLabelValue = null;
 }
예제 #5
0
 public void Dispose()
 {
     NewgameWindowValue = null;
     BackButtonValue    = null;
     StartButtonValue   = null;
     NameLabelValue     = null;
     NameTextfieldValue = null;
 }
예제 #6
0
 public void Dispose()
 {
     OptionsWindowValue   = null;
     BackButtonValue      = null;
     ResolutionLabelValue = null;
     ResOpt1ToggleValue   = null;
     ResOpt2ToggleValue   = null;
     ResOpt3ToggleValue   = null;
 }
예제 #7
0
 public OptionsWindowGuiAcessor(BitWindow root)
 {
     if (root == null)
     {
         throw new Exception("ROOT CANT BE NULL: OptionsWindowGuiAcessor");
     }
     this.root = root;
     Refresh();
 }
예제 #8
0
        public void Extension_Crystalize_Int32_NegativeTwo()
        {
            Byte[]    source = new byte[3];
            BitWindow window = new BitWindow(source, 3, 5, EndianBitIndexer.NativeBitIndexer);

            for (int bitIdx = 0; bitIdx < window.Length; bitIdx++)
            {
                window[bitIdx] = true;
            }
            window[0] = false;
            Assert.AreEqual(-2, BitConverter.ToInt32(window.Crystalize(IntegerFormat.S32), 0));
        }
예제 #9
0
        public void Extension_Shatter()
        {
            byte[]   source  = new byte[] { 18, 52 };
            UInt32[] results = new uint[] { 1, 2, 3, 4 };
            var      view    = new BitWindow(source);
            var      values  = view.Shatter(Enumerable.Repeat(4, 4)).Select(window => BitConverter.ToUInt32(window.Crystalize(IntegerFormat.U32), 0)).ToArray();

            for (int i = 0; i < 4; i++)
            {
                Assert.AreEqual(results[i], values[i]);
            }
        }
예제 #10
0
        public void Read_BitWindow_In32_One()
        {
            BitWindow window = new BitWindow(8);

            window[0] = true;
            byte[]    intBuffer = new byte[4];
            BitWindow intWindow = new BitWindow(intBuffer, 0, 32, EndianBitIndexer.LittleByteBigBitIndexer);

            window.WriteTo(intWindow, 0, 0, window.Length);
            Int32 result = BitConverter.ToInt32(intBuffer, 0);

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(1, result);
        }
예제 #11
0
        public void Extension_Crystalize_Int32_EnsureByteOrder()
        {
            byte[]    source = new byte[5];
            BitWindow window = new BitWindow(source, 3, 16, EndianBitIndexer.NativeBitIndexer);

            for (Int32 bitIdx = 8; bitIdx < 16; bitIdx++)
            {
                window[bitIdx] = true;
            }

            byte[] intBuffer = window.Crystalize(IntegerFormat.S32);
            Assert.AreEqual(unchecked ((Int32)0xffffff00), BitConverter.ToInt32(intBuffer, 0));
        }
예제 #12
0
    public void Start()
    {
        Component[] windows = gameObject.GetComponents(typeof(BitWindow));
        BitWindow   window  = null;

        for (int i = 0; i < windows.Length; i++)
        {
            if (windows[i].name == "webimagetest_window")
            {
                window = (BitWindow)windows[i];
                break;
            }
        }

        if (window == null)
        {
            Debug.LogError("Main window not found.");
            return;
        }

        BitButton    loadButton   = window.FindControl <BitButton>("load_button");
        BitTextField urlTextfield = window.FindControl <BitTextField>("url_textfield");

        pictureWebimage = window.FindControl <BitWebImage>("picture_webimage");
        consoleTextarea = window.FindControl <BitTextArea>("console_textarea");
        pictureHorizontalprogressbar = window.FindControl <BitHorizontalProgressBar>("picture_horizontalprogressbar");

        loadButton.MouseClick +=
            delegate
        {
            string url = urlTextfield.Text;
            url = url.Substring(url.LastIndexOf('/') + 1);

            BitWebImage.LoadImageResponse result = pictureWebimage.LoadImage(urlTextfield.Text);
            switch (result)
            {
            case BitWebImage.LoadImageResponse.ALREADY_LOADED:
                consoleTextarea.Text += "Image already loaded... " + url + Environment.NewLine;
                break;

            case BitWebImage.LoadImageResponse.OTHER_LOADING:
                consoleTextarea.Text += "Other loading in progress... " + Environment.NewLine;
                break;

            case BitWebImage.LoadImageResponse.OK:
                consoleTextarea.Text += "Loading image... " + url + Environment.NewLine;
                pictureHorizontalprogressbar.Value = 0;
                break;
            }
        };
    }
예제 #13
0
        public void Read_BitWindow_In32_NegativeOne()
        {
            BitWindow window = new BitWindow(32);

            for (int bitIdx = 0; bitIdx < window.Length; bitIdx++)
            {
                window[bitIdx] = true;
            }
            byte[]    intBuffer = new byte[4];
            BitWindow intWindow = new BitWindow(intBuffer, 0, 32, EndianBitIndexer.LittleByteBigBitIndexer);

            window.WriteTo(intWindow, 0, 0, window.Length);
            Int32 result = BitConverter.ToInt32(intBuffer, 0);

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(-1, result);
        }
    /// <summary>
    /// Initialization
    /// </summary>
    void Start()
    {
        //Find Controls
        window = this.transform.GetComponent(typeof(BitWindow)) as BitWindow;
        btnOK = this.transform.FindChild("btnOk").GetComponent<BitButton>();
        levelManager =  GameObject.FindObjectOfType(typeof(LevelManagerScript)) as LevelManagerScript;

        lblTitle = this.transform.FindChild("lblTitle").GetComponent<BitLabel>();
        lblMessage = this.transform.FindChild("lblMessage").GetComponent<BitLabel>();

        //Subscribe to events
        btnOK.MouseClick += new Bitverse.Unity.Gui.MouseClickEventHandler(btnOK_MouseClick);

        //Don't show the windows
        this.window.Enabled = false;
        this.window.Visible = false;
    }
예제 #15
0
    /// <summary>
    /// Initialization
    /// </summary>
    void Start()
    {
        //Find Controls
        window       = this.transform.GetComponent(typeof(BitWindow)) as BitWindow;
        btnOK        = this.transform.FindChild("btnOk").GetComponent <BitButton>();
        levelManager = GameObject.FindObjectOfType(typeof(LevelManagerScript)) as LevelManagerScript;

        lblTitle   = this.transform.FindChild("lblTitle").GetComponent <BitLabel>();
        lblMessage = this.transform.FindChild("lblMessage").GetComponent <BitLabel>();

        //Subscribe to events
        btnOK.MouseClick += new Bitverse.Unity.Gui.MouseClickEventHandler(btnOK_MouseClick);

        //Don't show the windows
        this.window.Enabled = false;
        this.window.Visible = false;
    }
예제 #16
0
 public void Dispose()
 {
     MarketWindowValue        = null;
     _1ItemlistLabelValue     = null;
     CloseButtonValue         = null;
     BuyButtonValue           = null;
     ItemlistGroupValue       = null;
     ItemListValue            = null;
     ItemGroupValue           = null;
     ItemnameLabelValue       = null;
     ItempriceLabelValue      = null;
     ItemimagePictureValue    = null;
     DescriptionGroupValue    = null;
     DescriptionTextareaValue = null;
     DescriptionLabelValue    = null;
     PriceLabelValue          = null;
     NameLabelValue           = null;
 }
예제 #17
0
        public void Read_BitWindow_Int32_EnsureByteOrder()
        {
            Int32     expectedValue = 0xff00;
            BitWindow window        = new BitWindow(32);

            for (Int32 bitIdx = 8; bitIdx < 16; bitIdx++)
            {
                window[bitIdx] = true;
            }

            byte[]    intBuffer = new byte[4];
            BitWindow intWindow = new BitWindow(intBuffer, 0, 32, EndianBitIndexer.LittleByteBigBitIndexer);

            window.WriteTo(intWindow, 0, 0, window.Length);
            Int32 result = BitConverter.ToInt32(intBuffer, 0);

            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(expectedValue, result);
        }
예제 #18
0
    private void StartMainWindowComponents(BitWindow window)
    {
        var accessor = new MainmenuWindowGuiAcessor(window);

        accessor.NewgameButton.MouseClick +=
            (sender, e) =>
        {
            UnloadWindow(MainMenuPrefab);
            StartNewGameWindowComponents(OpenWindow(NewGamePrefab));
        };

        accessor.OptionsButton.MouseClick +=
            (sender, e) =>
        {
            UnloadWindow(MainMenuPrefab);
            StartOptionsWindowComponents(OpenWindow(OptionsPrefab));
        };

        accessor.ExitButton.MouseClick += (sender, e) => Application.Quit();
    }
예제 #19
0
    private void StartOptionsWindowComponents(BitWindow window)
    {
        var accessor = new OptionsWindowGuiAcessor(window);

        accessor.ResOpt1Toggle.SetValue(false);
        accessor.ResOpt2Toggle.SetValue(false);
        accessor.ResOpt3Toggle.SetValue(false);
        var width = Screen.width;

        switch (width)
        {
        case 1280:
            accessor.ResOpt2Toggle.SetValue(true);
            break;

        case 1440:
            accessor.ResOpt3Toggle.SetValue(true);
            break;

        default:
            accessor.ResOpt1Toggle.SetValue(true);
            break;
        }

        accessor.BackButton.MouseClick +=
            (sender, e) =>
        {
            UnloadWindow(OptionsPrefab);
            StartMainWindowComponents(OpenWindow(MainMenuPrefab));
        };

        accessor.ResOpt1Toggle.ValueChanged +=
            (sender, e) =>
        {
            if ((bool)e.Value)
            {
                ((BitToggle)sender).SetValue(true);
            }
            accessor.ResOpt2Toggle.SetValue(false);
            accessor.ResOpt3Toggle.SetValue(false);
            Screen.SetResolution(1024, 768, false);
        };
        accessor.ResOpt2Toggle.ValueChanged +=
            (sender, e) =>
        {
            if ((bool)e.Value)
            {
                ((BitToggle)sender).SetValue(true);
            }
            accessor.ResOpt1Toggle.SetValue(false);
            accessor.ResOpt3Toggle.SetValue(false);
            Screen.SetResolution(1280, 720, false);
        };
        accessor.ResOpt3Toggle.ValueChanged +=
            (sender, e) =>
        {
            if ((bool)e.Value)
            {
                ((BitToggle)sender).SetValue(true);
            }
            accessor.ResOpt1Toggle.SetValue(false);
            accessor.ResOpt2Toggle.SetValue(false);
            Screen.SetResolution(1440, 900, false);
        };
    }
예제 #20
0
 public void Ctor_NegativeOffset()
 {
     BitWindow window = new BitWindow(new byte[1], -1, 8, EndianBitIndexer.LittleByteBigBitIndexer);
 }
예제 #21
0
 public void Ctor_ZeroBitLength()
 {
     BitWindow window = new BitWindow(0);
 }
예제 #22
0
 public void Ctor_NegativeBitLength()
 {
     BitWindow window = new BitWindow(-1);
 }
예제 #23
0
 public void Ctor_NullBytes()
 {
     BitWindow window = new BitWindow(null);
 }
예제 #24
0
 public void Ctor_ZeroBytes()
 {
     BitWindow window = new BitWindow(new byte[] { });
 }
예제 #25
0
	void Awake(){
		root = GetComponent<BitStage>();
		
		gameControlWindow = root.FindControl<BitWindow>("EGameControlWindow");
		conversation = gameControlWindow.FindControl<BitBox>("ConversationBox");
		BitGroup headGroup = gameControlWindow.FindControl<BitGroup>("HeadGroup");
		
		helpButton = headGroup.FindControl<BitButton>("help");
		exitButton = headGroup.FindControl<BitButton>("exit");
		progressBar = headGroup.FindControl<BitGroup>("progress_bg").FindControl<BitHorizontalProgressBar>();
		tickCounter = gameControlWindow.FindControl<BitGroup>("TickCounter_bg").FindControl<BitVerticalProgressBar>();
		centerGroup = gameControlWindow.FindControl<BitGroup>("CenterGroup");
		skipDemoBtn = centerGroup.FindControl<BitButton>("SkipDemoBtn");
		playDemoBtn = centerGroup.FindControl<BitButton>("PlayDemoBtn");
		startButton = centerGroup.FindControl<BitButton>("start");
		
		gameHelpWindow = root.FindControl<BitWindow>("EGameHelpWindow");
		hPictureRender = gameHelpWindow.FindControl<BitPicture>();
		hPreBtn = gameHelpWindow.FindControl<BitButton>("help_btn_prev");
		hNextBtn = gameHelpWindow.FindControl<BitButton>("help_btn_next");
		hCloseBtn = gameHelpWindow.FindControl<BitButton>("close");
		hAlwaysShowHelp = gameHelpWindow.FindControl<BitToggle>();
		
		gameWindow = root.FindControl<BitWindow>("GameWindow");
	}
예제 #26
0
    public void Start()
    {
        _tag = new Dictionary <BitButton, int>();

        Component[] windows = gameObject.GetComponents(typeof(BitWindow));
        BitWindow   window  = null;

        for (int i = 0; i < windows.Length; i++)
        {
            if (windows[i].name == "calculator_window")
            {
                window = (BitWindow)windows[i];
            }
        }

        if (window == null)
        {
            Debug.LogError("Main window not found.");
            return;
        }

        _result      = window.FindControl <BitLabel>("Result");
        _resultLabel = window.FindControl <BitLabel>("ResultLabel");
        _group       = window.FindControl <BitGroup>("Group");

        BitButton b;

        for (int i = 0; i < 10; i++)
        {
            b = _group.FindControl <BitButton>(i.ToString());

            _tag.Add(b, i);
            b.MouseClick += NumericClick;
        }
        b             = _group.FindControl <BitButton>(".");
        b.MouseClick += DotClick;

        b = _group.FindControl <BitButton>("+");
        _tag.Add(b, (int)Operations.Plus);
        b.MouseClick += OperationClick;

        b = _group.FindControl <BitButton>("-");
        _tag.Add(b, (int)Operations.Minus);
        b.MouseClick += OperationClick;

        b = _group.FindControl <BitButton>("*");
        //b.Tag = Operations.Multiplication;
        _tag.Add(b, (int)Operations.Multiplication);
        b.MouseClick += OperationClick;

        b = _group.FindControl <BitButton>("/");
        _tag.Add(b, (int)Operations.Division);
        b.MouseClick += OperationClick;

        b             = _group.FindControl <BitButton>("=");
        b.MouseClick += EqualsClick;

        b             = _group.FindControl <BitButton>("C");
        b.MouseClick += ClearClick;

        b             = _group.FindControl <BitButton>("Bk");
        b.MouseClick += BackClick;

        Reset();
    }
예제 #27
0
 public void Ctor_NullIndexer()
 {
     BitWindow window = new BitWindow(new byte[1], 0, 8, null);
 }
 public void Dispose()
 {
     EscWindowValue        = null;
     BacktogameButtonValue = null;
     ExitgameButtonValue   = null;
 }
예제 #29
0
 public void Ctor_InsufficientBitsInSourceBecauseOfOffset()
 {
     BitWindow window = new BitWindow(new byte[1], 7, 8, EndianBitIndexer.LittleByteBigBitIndexer);
 }
예제 #30
0
 public void Ctor_InsufficientBitsInSource()
 {
     BitWindow window = new BitWindow(new byte[1], 0, 16, EndianBitIndexer.LittleByteBigBitIndexer);
 }
예제 #31
0
    private void Start()
    {
        _form = gameObject.GetComponent <BitEditorStage>();
        if (_form == null)
        {
            Debug.LogError("Form not found");
            return;
        }


        _window = _form.FindControl <BitWindow>("main_window");
        if (_window == null)
        {
            Debug.LogError("'main_window' not found");
            return;
        }

        _simpleButton = _window.FindControl <BitButton>("SimpleButton");

        if (_simpleButton == null)
        {
            Debug.LogWarning("'SimpleButton' not found!");
        }
        else
        {
            _simpleButton.MouseClick += SimpleButton_MouseClick;
        }

        _repeatButton = _window.FindControl <BitRepeatButton>("RepeatButton");
        if (_repeatButton == null)
        {
            Debug.LogWarning("'RepeatButton' not found!");
        }
        else
        {
            _repeatButton.MouseHold += RepeatButtonMouseHold;
        }

        _textGroup = _window.FindControl <BitGroup>("TextGroup");
        if (_textGroup == null)
        {
            Debug.Log("'TextGroup' not fount!");
        }

        _toggle = _window.FindControl <BitToggle>("Toggle");
        if (_toggle == null)
        {
            Debug.LogWarning("'Toggle' not found!");
        }
        else
        {
            _toggle.ValueChanged += Toggle_ValueChanged;
            if (_textGroup != null)
            {
                _textGroup.Enabled = false;
            }
        }

        if (_textGroup != null)
        {
            _textField = _textGroup.FindControl <BitTextField>("TextField");
            if (_textField == null)
            {
                Debug.LogWarning("'TextField' not found!");
            }
            else
            {
                _textField.TextChanged += TextChanged;
            }

            _textArea = _textGroup.FindControl <BitTextArea>("TextArea");
            if (_textArea == null)
            {
                Debug.LogWarning("'TextArea' not found!");
            }
            else
            {
                _textArea.TextChanged += TextChanged;
            }

            _passwordField = _textGroup.FindControl <BitPasswordField>("PasswordField");
            if (_passwordField == null)
            {
                Debug.LogWarning("'PasswordField' not found!");
            }
            else
            {
                _passwordField.TextChanged += TextChanged;
            }
        }

        _textureGroup = _window.FindControl <BitGroup>("TextureGroup");
        if (_textureGroup == null)
        {
            Debug.LogWarning("'TextureGroup' not found!");
        }
        else
        {
//			_texture = _textureGroup.FindControl<BitDrawTexture>("Texture");
//			if (_texture == null)
//			{
//				Debug.LogWarning("'Texture' not found!");
//			}
        }

        _hsLabel = _window.FindControl <BitLabel>("HorizontalSlider Label");
        if (_hsLabel == null)
        {
            Debug.LogWarning("'HorizontalSlider Label' not found!");
        }

        _horizontalSlider = _window.FindControl <BitHorizontalSlider>("HorizontalSlider");
        if (_horizontalSlider == null)
        {
            Debug.LogWarning("'HorizontalSlider' not found!");
        }
        else
        {
            _horizontalSlider.ValueChanged += HorizontalSlider_ValueChanged;
        }

        _vsLabel = _window.FindControl <BitLabel>("VerticalSlider Label");
        if (_vsLabel == null)
        {
            Debug.LogWarning("'VerticalSlider Label' not found!");
        }

        _verticalSlider = _window.FindControl <BitVerticalSlider>("VerticalSlider");
        if (_verticalSlider == null)
        {
            Debug.LogWarning("'HorizontalSlider' not found!");
        }
        else
        {
            _verticalSlider.ValueChanged += VerticalSlider_ValueChanged;
        }

        _gridList = _window.FindControl <BitGridList>("GridList");
        if (_gridList == null)
        {
            Debug.LogWarning("'GridList' not found!");
        }
        else
        {
            _gridList.Populator = new DefaultBitListPopulator();
        }

        _multiselectionToggle = _window.FindControl <BitToggle>("MultiSelection Toggle");
        if (_multiselectionToggle == null)
        {
            Debug.LogWarning("'MultiSelection Toggle' not found!");
        }
        else
        {
            _multiselectionToggle.ValueChanged += MultiselectionToggle_ValueChanged;
        }

        _list = _window.FindControl <BitList>("List");
        if (_list == null)
        {
            Debug.LogWarning("'List' not found!");
        }
        else
        {
            _list.Populator         = new MyListPopulator();
            _list.SelectionChanged += List_SelectionChanged;
        }

        _listSelectionLabel = _window.FindControl <BitLabel>("ListSelection Label");
        if (_listSelectionLabel == null)
        {
            Debug.LogWarning("'ListSelection Label' not found!");
        }

        _labelWithPopup = _window.FindControl <BitLabel>("Label With Popup");
        if (_labelWithPopup == null)
        {
            Debug.LogWarning("'Label With Popup' not found!");
        }

        PopulateDropDown();

        PopulateContextMenu();
    }