Exemplo n.º 1
0
    void Start()
    {
        // The text-extrude API is experimental and therefore unstable and unoptimised.
        // This example is provided straight from our test bench as a preview of what PowerUI 2 is capable of.

        // We're going to increase the curve accuracy - this results in smoother curves.
        // This of course means more triangles, but this text is the only thing here anyway.
        // TextExtrude.CurveAccuracy/=10f;


        // Create a WorldUI:
        WorldUI ui = new WorldUI();

        // Let's give it some space - this will affect the wrapping of the text:
        ui.SetDimensions(500, 100);

        // Define the resolution - that's how many pixels per world unit.
        // This of course entirely depends on the usage.
        ui.SetResolution(10);

        if (Html == null)
        {
            Debug.Log("No HTML file defined for 3D text!");
            return;
        }

        // Apply the content:
        ui.document.innerHTML = "<div style='text-extrude:4;font-size:30px;height:100%;vertical-align:middle;text-align:center;font-family:Hardwood;'>" + Html.text + "</div>";
    }
Exemplo n.º 2
0
    void Awake()
    {
        _canvas = GetComponent <Canvas>();
        _currentBuildingWorld = world_0_container;

        _screenSelectorsUI.Add(selectedScreenUI);
    }
	void Start(){
		
		// The text-extrude API is experimental and therefore unstable and unoptimised.
		// This example is provided straight from our test bench as a preview of what PowerUI 2 is capable of.
		
		// We're going to increase the curve accuracy - this results in smoother curves.
		// This of course means more triangles, but this text is the only thing here anyway.
		// TextExtrude.CurveAccuracy/=10f;
		
		
		// Create a WorldUI:
		WorldUI ui=new WorldUI();
		
		// Let's give it some space - this will affect the wrapping of the text:
		ui.SetDimensions(500,100);
		
		// Define the resolution - that's how many pixels per world unit.
		// This of course entirely depends on the usage.
		ui.SetResolution(10);
		
		if(Html==null){
			Debug.Log("No HTML file defined for 3D text!");
			return;
		}
		
		// Apply the content:
		ui.document.innerHTML="<div style='text-extrude:4;font-size:30px;height:100%;vertical-align:middle;text-align:center;font-family:Hardwood;'>"+Html.text+"</div>";
		
	}
Exemplo n.º 4
0
    public void AddLevelButton(LevelInfo lvlInfo, Action <LevelInfo> onClick, GameManager gm, bool worldUnlocked, int neededToUnlock)
    {
        if (lvlInfo.worldId != _lvlBtn_lastWorldId)
        {
            var newWorldUI = Instantiate <WorldUI>(world_0_container, worldsTransform);
            newWorldUI.transform.position += Vector3.right * _canvas.pixelRect.width * lvlInfo.worldId;
            newWorldUI.name = "world_" + lvlInfo.worldId;
            _worldsCreated.Add(newWorldUI);


            newWorldUI.Init(lvlInfo.worldId, worldUnlocked, neededToUnlock);

            _currentBuildingWorld = newWorldUI;

            _amountOfWorlds++;

            CreateScreenPointUI(lvlInfo.worldId);
        }

        var       btn         = Instantiate <Button>(levelNodeButton, _currentBuildingWorld.grid.transform);
        LevelInfo lazyLvlInfo = new LevelInfo();

        lazyLvlInfo = lvlInfo;
        btn.onClick.AddListener(() => onClick(lazyLvlInfo));
        var node = btn.GetComponent <LevelNode> ();

        node.Init(lazyLvlInfo, gm, btn);

        _lvlBtn_lastWorldId = lvlInfo.worldId;
    }
Exemplo n.º 5
0
 protected unsafe override void Awake()
 {
     //IL_0018: Unknown result type (might be due to invalid IL or missing references)
     //IL_0022: Expected O, but got Unknown
     //IL_0034: Unknown result type (might be due to invalid IL or missing references)
     //IL_003e: Expected O, but got Unknown
     //IL_0050: Unknown result type (might be due to invalid IL or missing references)
     //IL_005a: Expected O, but got Unknown
     //IL_006c: Unknown result type (might be due to invalid IL or missing references)
     //IL_0076: Expected O, but got Unknown
     //IL_0088: Unknown result type (might be due to invalid IL or missing references)
     //IL_0092: Expected O, but got Unknown
     //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
     //IL_00ae: Expected O, but got Unknown
     //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
     //IL_00ca: Expected O, but got Unknown
     s_instance = this;
     m_pvpButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_gotoTofuButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_gotoGardenButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_gotoHomeButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_gotoCityButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_disconnectButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_squadMakerButton.get_onClick().AddListener(new UnityAction((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/));
     m_gotoHomeButton.set_interactable(false);
     m_gotoTofuButton.set_interactable(true);
     m_gotoGardenButton.set_interactable(true);
     m_gotoCityButton.set_interactable(true);
     InitGodsChoice();
 }
Exemplo n.º 6
0
    void Start()
    {
        instance = this;

        // resolution
        Resolution currentResolution = Screen.currentResolution;
        if (Application.isEditor) {
            screenResolution = Screen.resolutions [0];
        } else {
            screenResolution = currentResolution;
        }
        //set the resolution
        Screen.SetResolution (screenResolution.width, screenResolution.height, true);

        // UI Camera setup

        UICamera = new GameObject ("UICamera");
        UICamera.AddComponent<Camera>();

        Camera uiCamera = UICamera.GetComponent<Camera>();

        uiCamera.cullingMask = uiCameraLayerMask;
        uiCamera.name = "UICamera";
        uiCamera.orthographicSize = screenResolution.height / 2;
        uiCamera.orthographic = true;
        uiCamera.nearClipPlane = 0.3f;
        uiCamera.farClipPlane = 50f;
        uiCamera.clearFlags = CameraClearFlags.Depth;
        uiCamera.depth = 1;
        uiCamera.rect = new Rect (0, 0, 1, 1);
        uiCamera.renderingPath = RenderingPath.UsePlayerSettings;
        uiCamera.targetTexture = null;
        uiCamera.hdr = false;
    }
Exemplo n.º 7
0
 private static void SetEnable(WorldUI ui, bool enable)
 {
     if (ui != null)
     {
         ui.document.Run("SetUnitBarEnable", enable);
     }
 }
Exemplo n.º 8
0
	// Use this for initialization
	void Start () {
		
		// Next, generate a new UI:
		WorldUI ui=new WorldUI("TVScreenContent");
		
		// It's representing a TV, so lets use some standard TV screen dimensions:
		ui.SetDimensions(800,600);
		
		// But we need to define the resolution - that's how many pixels per world unit.
		// This of course entirely depends on the model and usage.
		ui.SetResolution(540,610);
		
		// As this example only uses a WorldUI, we'll set the filter mode to bilinear so it looks smoother.
		ui.TextFilterMode=FilterMode.Bilinear;
		
		// Give it some content:
		if(HtmlFile!=null){
			ui.document.innerHTML=HtmlFile.text;
		}
		
		// Parent it to the TV:
		ui.transform.parent=transform;
		
		// Let's move it around a little too:
		ui.transform.localPosition=new Vector3(0f,1.02f,0.03f);
		
		// And spin it around - the TV mesh is facing the other way:
		ui.transform.localRotation=Quaternion.AngleAxis(180f,Vector3.up);
		
		if(InputEnabled){
			// World UI's should accept input:
			UI.WorldInputMode=InputMode.Screen;
		}
		
	}
Exemplo n.º 9
0
    public static void Pop(string text, Vector3 position)
    {
        var popup = Instantiate(Instance.popupPrefab);

        WorldUI.AddedUIElement(popup.transform as RectTransform);
        WorldUI.MoveUIByWorldPosition(popup.transform, position);
        popup.Text.text = text;
    }
Exemplo n.º 10
0
    void MoveTowards(Vector3 point)
    {
        // TODO: move this to a proper place
        WorldUI.CloseAllMenu();
        point.y = transform.position.y;
        target  = point;

        StopAllCoroutines();
        StartCoroutine(Moving());
    }
Exemplo n.º 11
0
    void Awake()
    {
        _canvas     = GetComponent <Canvas>();
        _swapSystem = GetComponent <WorldScreenSwapSystem>();
        _swapSystem.Init(this);

        _currentBuildingWorld = world_0_container;

        worldsCreated.Add(world_0_container);
    }
Exemplo n.º 12
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            g      = pictureBox.CreateGraphics();
            bitmap = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
            world  = new WorldUI(g, bitmap, ClientRectangle);
            updateTimer.Start();
            Thread payFactoryThread = new Thread(world.PayFactory);

            payFactoryThread.Start();
        }
Exemplo n.º 13
0
 protected void Start()
 {
     Hp = new Hp(startMaxHp, 0, startMaxHp);
     hpManager.CurHealth    = Hp;
     Hp.OnValueChangeToMin += Hp_OnValueChangeToMin;
     Hp.OnValueChanged     += Hp_OnValueChanged;
     Hp.OnHpTaken          += Hp_OnHpTaken;
     hpManager.Refresh();
     PhaseController.Instance.OnPhaseChanged += Instance_OnPhaseChanged;
     carrierUI = GameObject.FindGameObjectWithTag("CarrierUI").GetComponent <WorldUI>();
 }
Exemplo n.º 14
0
        public override void OnAdd()
        {
            Vector3 screenPoint = RectTransformUtility.WorldToScreenPoint(Camera.main, target.transform.position);

            WorldUI vfx = Instantiate(TauntUIVFX, screenPoint, Quaternion.identity) as WorldUI;

            vfx.GetComponent <RectTransform>().SetParent(UIManager.Instance.WorldUi.transform);
            vfx.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
            vfx.offset         = new Vector2(0, 30);
            vfx.owner          = target;
            vfxInstance        = vfx.gameObject;
            target.tauntTarget = owner;
        }
Exemplo n.º 15
0
    /// <summary>
    /// USed by the dev button at the upper left corner.
    /// </summary>
    public void ForceUnlockAllLevels()
    {
        foreach (var item in _worldsCreated)
        {
            Destroy(item.gameObject);
        }

        _lvlBtn_lastWorldId   = 0;
        _currentBuildingWorld = world_0_container;
        world_0_container.DeleteGridChildren();


        _amountOfWorlds = 1;
        mainMap.GetRealGameManager().User.LevelProgressManager.ForceWinAllLevels();
        mainMap.CreateLevelNodes();
    }
Exemplo n.º 16
0
        public ReflowDocument(WorldUI world)
        {
            worldUI = world;

            // Create the default viewport:

            if (worldUI != null)
            {
                Viewport = new Viewport(worldUI.pixelWidth, worldUI.pixelHeight);
            }
            else
            {
                Viewport = new Viewport(ScreenInfo.ScreenXFloat, ScreenInfo.ScreenYFloat);
            }

            ActiveFonts = new Dictionary <string, DynamicFont>();
        }
Exemplo n.º 17
0
    public static void Pop(string text, Vector3 position, Color color)
    {
        var popup = Instantiate(Instance.popupPrefab);

        WorldUI.AddedUIElement(popup.transform as RectTransform);
        WorldUI.MoveUIByWorldPosition(popup.transform, position);
        popup.Text.text = text;

        var alphaKeys = popup.Color.alphaKeys;
        var colorKeys = popup.Color.colorKeys;

        for (int i = 0; i < colorKeys.Length; i++)
        {
            colorKeys[i].color = color;
        }

        popup.Color.SetKeys(colorKeys, alphaKeys);
    }
Exemplo n.º 18
0
        public static WorldUI SetupUnitBar(GameEntity ent)
        {
            WorldUI unitBar;

            if (UIDict.ContainsKey(ent) && UIDict[ent].gameObject != null)
            {
                unitBar = UIDict[ent];
                SetEnable(unitBar, true);
                if (unitBar.Expires)
                {
                    unitBar.CancelExpiry();
                }
                return(unitBar);
            }

            //UI
            unitBar     = new WorldUI(BarWeight, BarHeight);
            UIDict[ent] = unitBar;

            //Return or Create
            var point = SetupPoint(ent);

            //Attach to point and setup HTML
            unitBar.ParentToOrigin(point.transform);
            unitBar.document.innerHTML = StaticUnitBarHTML.text;

            //Unit special info
            var name = LanguageTextManager.GetTextByName(ent.OriginalName);

            unitBar.document.Run("SetupUnitName", name);

            var unit = ent as AbstractGameObject;

            if (unit == null)
            {
                return(unitBar);
            }
            if (!ClickManager.IsChoosed(unit.gameObject))
            {
                unitBar.SetExpiry(5f);
            }
            UpdateInfo(unit);
            return(unitBar);
        }
Exemplo n.º 19
0
    public void AddLevelButton(LevelInfo lvlInfo, Action <LevelInfo> onClick, GameManager gm, bool worldUnlocked, int neededToUnlock)
    {
        if (lvlInfo.worldId != _lvlBtn_lastWorldId)
        {
            var newWorldUI = Instantiate <WorldUI>(world_0_container, worldsTransform);
            newWorldUI.transform.position += Vector3.right * _canvas.pixelRect.width * lvlInfo.worldId;
            newWorldUI.name = "world_" + lvlInfo.worldId;
            worldsCreated.Add(newWorldUI);
            newWorldUI.Init(lvlInfo.worldId, worldUnlocked, neededToUnlock);
            newWorldUI.gameObject.SetActive(false);
            _currentBuildingWorld = newWorldUI;

            _amountOfWorlds++;
            _swapSystem.amountOfWorlds = _amountOfWorlds;

            _lvlBtn_index = 0;
        }

        if (lvlInfo.id == -1)
        {
            var currentLevelProgress = mainMap.GetGameManager().User.LevelProgressManager.GetProgress(lvlInfo.id);
            if (currentLevelProgress != null && currentLevelProgress.won)
            {
                return;//don't want to display level-1 if it's already done
            }
        }

        var       btn         = Instantiate <Button>(levelNodeButton, _currentBuildingWorld.grid.transform);
        LevelInfo lazyLvlInfo = new LevelInfo();

        lazyLvlInfo = lvlInfo;
        btn.onClick.AddListener(() => onClick(lazyLvlInfo));
        btn.name = "levelNodeButton_" + _lvlBtn_index;

        var node = btn.GetComponent <LevelNode> ();

        node.Init(lazyLvlInfo, gm, btn);

        _lvlBtn_lastWorldId = lvlInfo.worldId;
        _lvlBtn_index++;
    }
Exemplo n.º 20
0
    public override void StartInteracting()
    {
        if (status.fouled)
        {
            return;
        }

        if (!status.plantedCrop)
        {
            WorldUI.MoveUIByWorldPosition(WorldUI.CropMenu.transform, this.transform.position);
            WorldUI.CropMenu.OpenMenu();
            WorldUI.CropMenu.OnChosed += CropMenu_OnCropChosed;
            return;
        }
        else
        {
            Harvest();
        }

        base.StartInteracting();
    }
Exemplo n.º 21
0
    /// <summary>Shows the given message above the given object.</summary>
    public void ShowMessage(string message, GameObject aboveObject)
    {
        // We'll use WorldUI's for this - no need to mess around with updating etc.
        // As a worldUI is like a small screen, it needs some pixel space - that's how much space the message HTML has (100px x 100px).
        WorldUI messageUI = new WorldUI(110, 100);

        // Put it in pixel perfect mode - this is what makes it "stick" to the camera:
        messageUI.PixelPerfect = true;

        // Write the message to it:
        // Important note! If the message originates from players, don't forget that they could potentially write HTML (scripts especially).
        // textContent is supported too (e.g. messageUI.document.body.textContent) which will write the message "as is".

        // We're also going to give it a bit of extra style, e.g. a faded white background:
        messageUI.document.innerHTML = "<div style='padding:5px;background:#ffffffaa;text-align:center;'>" + message + "</div>";

        // Parent it to and go to the origin of the gameobject:
        messageUI.ParentToOrigin(aboveObject);

        // Make the message destroy itself after 5 seconds:
        messageUI.SetExpiry(5f);
    }
Exemplo n.º 22
0
        public static void UpdateInfo(GameEntity ent)
        {
            if (ent == null)
            {
                return;
            }
            WorldUI ui = null;

            if (UIDict.ContainsKey(ent))
            {
                ui = UIDict[ent];
            }

            if (ui == null || ui.gameObject == null)
            {
                ui = SetupUnitBar(ent);
            }


            var unit = ent as AbstractGameObject;

            if (unit == null)
            {
                return;
            }

            //Debug.Log("UpdateInfo: " +unit+" HP:"+unit.UpgradedStats.Hp);

            //UnitBar
            ui.document.Run("UpdateHearts", unit.GetCurrentHp(), unit.GetMaxHp());
            //Main ui
            if (ClickManager.GetChoosedEnt() != ent)
            {
                return;
            }
            UI.document.Run("UpdateHP_count", unit.GetCurrentHp());
            UI.document.Run("UpdateHP_max", unit.GetMaxHp());
        }
	/// <summary>Shows the given message above the given object.</summary>
	public void ShowMessage(string message,GameObject aboveObject){
		
		// We'll use WorldUI's for this - no need to mess around with updating etc.
		// As a worldUI is like a small screen, it needs some pixel space - that's how much space the message HTML has (100px x 100px).
		WorldUI messageUI=new WorldUI(110,100);
		
		// Put it in pixel perfect mode - this is what makes it "stick" to the camera:
		messageUI.PixelPerfect=true;
		
		// Write the message to it:
		// Important note! If the message originates from players, don't forget that they could potentially write HTML (scripts especially).
		// textContent is supported too (e.g. messageUI.document.body.textContent) which will write the message "as is".
		
		// We're also going to give it a bit of extra style, e.g. a faded white background:
		messageUI.document.innerHTML="<div style='padding:5px;background:#ffffffaa;text-align:center;'>"+message+"</div>";
		
		// Parent it to and go to the origin of the gameobject:
		messageUI.ParentToOrigin(aboveObject);
		
		// Make the message destroy itself after 5 seconds:
		messageUI.SetExpiry(5f);
		
	}
Exemplo n.º 24
0
    // Use this for initialization
    void Start()
    {
        // Next, generate a new UI:
        WorldUI ui = new WorldUI("TVScreenContent");

        // It's representing a TV, so lets use some standard TV screen dimensions:
        ui.SetDimensions(800, 600);

        // But we need to define the resolution - that's how many pixels per world unit.
        // This of course entirely depends on the model and usage.
        ui.SetResolution(540, 610);

        // As this example only uses a WorldUI, we'll set the filter mode to bilinear so it looks smoother.
        ui.TextFilterMode = FilterMode.Bilinear;

        // Give it some content:
        if (HtmlFile != null)
        {
            ui.document.innerHTML = HtmlFile.text;
        }

        // Parent it to the TV:
        ui.transform.parent = transform;

        // Let's move it around a little too:
        ui.transform.localPosition = new Vector3(0f, 1.02f, 0.03f);

        // And spin it around - the TV mesh is facing the other way:
        ui.transform.localRotation = Quaternion.AngleAxis(180f, Vector3.up);

        if (InputEnabled)
        {
            // World UI's should accept input:
            UI.WorldInputMode = InputMode.Screen;
        }
    }
Exemplo n.º 25
0
    /// <summary>
    /// USed by the dev button
    /// </summary>
    public void ForceUnlockAllLevels()
    {
        foreach (var item in worldsCreated)
        {
            if (item.GetInstanceID() != world_0_container.GetInstanceID())
            {
                Destroy(item.gameObject);
            }
        }

        worldsCreated = new List <WorldUI>();
        worldsCreated.Add(world_0_container);

        _lvlBtn_lastWorldId   = 0;
        _currentBuildingWorld = world_0_container;
        world_0_container.DeleteGridChildren();


        _amountOfWorlds = 1;
        mainMap.GetGameManager().User.LevelProgressManager.ForceWinAllLevels();
        mainMap.CreateLevelNodes();

        //_worldsCreated[_currentWorldOnScreen].gameObject.SetActive(true);
    }
Exemplo n.º 26
0
 /// <summary>Creates a new renderer for rendering in the world.</summary>
 public Renderman(WorldUI worldUI)
 {
     Node      = worldUI.gameObject;
     InWorldUI = worldUI;
     Init();
 }
Exemplo n.º 27
0
 void Awake()
 {
     main = this;
 }
Exemplo n.º 28
0
 protected void Start()
 {
     ResourceUI = GameObject.FindGameObjectWithTag("ResourceUI").GetComponent <WorldUI>();
     ResourceUI.ResourceCounter.text = 0.ToString();
 }
Exemplo n.º 29
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     s_instance = null;
 }
Exemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     instance = this;
 }
Exemplo n.º 31
0
 protected new void Awake()
 {
     base.Awake();
     IsFixed = isFixedInit;
     worldUI = GameObject.FindGameObjectWithTag("BridgeUI").GetComponent <WorldUI>();
 }