Inheritance: MonoBehaviour
示例#1
0
 // Use this for initialization
 void Start()
 {
     instance = this;
     GameEventManager.GameStart += GameStart;
     GameEventManager.GameOver += GameOver;
     gameOverText.enabled = false;
 }
        void Awake()
        {
            IM = GameObject.FindGameObjectWithTag("InputManager").GetComponent<InputManager>();
            GM = GUIManager.Instance;
            EM = EventManager.Instance;

            camera.enabled = false;
            camera.rect = objectViewArea;

            // this box goes to GUIManager, who will render it behind the camera render, creating borders.
            showboxEdge = new Rect(objectViewArea.x * Screen.width - edgeStyleForShowbox.border.left,
                                   objectViewArea.y * Screen.height - edgeStyleForShowbox.border.top,
                                   objectViewArea.width * Screen.width + edgeStyleForShowbox.border.right*2,
                                   objectViewArea.height * Screen.height + edgeStyleForShowbox.border.bottom*2);

            textbox = ((GameObject)Instantiate(pagedTextPrefab)).GetComponent<PagedTextbox>();
            textbox.SetPosition(Screen.width*textboxViewArea.x, Screen.height*textboxViewArea.y);
            // textbox is a4 shaped now: setting x wont matter
            textbox.SetSize(Screen.height*textboxViewArea.height / Mathf.Sqrt(2), Screen.height*textboxViewArea.height);
            textbox.Show = false;

            closeButtonRect = new Rect(Screen.width - closeButton.width, 0, closeButton.width, closeButton.height);

            EM.ViewHistoricalObject += HandleViewHistoricalObject;
            EM.HideHistoricalObject += HandleHideHistoricalObject;
        }
示例#3
0
	// Use this for initialization
	void Start () {

		if(Instance != null){
			GameObject.Destroy(gameObject);
		}
		else{
			GameObject.DontDestroyOnLoad(gameObject);
			Instance = this; 
		}
		//initialize sceneHandler object
		//sceneHandler = sceneHandler.GetComponent<SceneHandler>();
		//sceneHandler= GameObject.Find("SceneHandler").gameObject.GetComponent<GameObject>();
		charactersCanvas = charactersCanvas.GetComponent<Canvas> (); //drop the charactersCanvas to Unity
		evidenceCanvas = evidenceCanvas.GetComponent<Canvas> (); //drop the evidenceCanvas to Unity
		
		infoMainMenuCavas.enabled = true; //this is true by default, but just incase
		//initial sub menus are NOT enabled until clicked on
		charactersCanvas.enabled = false; //Exit button isn't pressed @ start of game
		evidenceCanvas.enabled = false;		
		//sub menu buttons
		queCharactersText = queCharactersText.GetComponent<Button>();
		evidenceText = evidenceText.GetComponent<Button>();
		quitGameText = quitGameText.GetComponent<Button>();

		backToInfoText = backToInfoText.GetComponent<Button>();

		//pickKillerObj = GameObject.Find("PickKillerEmpty").gameObject.GetComponent<PickKiller>();
		//killerID = pickKillerObj.getRandomizedKiller();
		//Debug.Log("KillerID from GUIManager: ");
		//Debug.Log(killerID);
	}
示例#4
0
    private void Awake()
    {
        Debug.Log("Awake");
        myScriptScale = new ScriptScale();
        myScriptScale.PersonWidth = PersonWidth;
        myScriptScale.InterPersonSpacing = InterPersonSpacing;
        myScriptScale.InterHouseSpacing = InterHouseSpacing;
        myScriptScale.GenerationGap = GenerationGap;
        myScriptScale.ZScale = ZScale;

        // Let the GUI Manager know about our ZScale
        gui = FindObjectOfType(typeof(GUIManager)) as GUIManager;
        gui.SendMessage("myInitZScale", ZScale);

        myPeople = new MyPeople();
        _generationInformationDictionary = new Dictionary<int, GenerationInformation>();

        _personsBirthPlatformObjects = new GameObject[1500];
        _personsWeddingPlatformObjects = new GameObject[1500];

        _weddingDayDestinationObjects = new GameObject[1500];

        _birthDayDestinationObjects = new GameObject[1500];

        // _personPrefab = Resources.Load("FirstPerson");
    }
	public static void ShowWindow()
	{
		//Show existing window instance. If one doesn't exist, make one.
		if ( GUIManager.GUIEditWindowSize.x != 0.0f && GUIManager.GUIEditWindowSize.y != 0.0f )
		{
			GetWindow<GUIManagerWindow>().minSize = GUIManager.GUIEditWindowSize;
			GetWindow<GUIManagerWindow>().maxSize = GUIManager.GUIEditWindowSize;
			EditorWindow.GetWindowWithRect(typeof(GUIManagerWindow),new Rect(0,0,GUIManager.GUIEditWindowSize.x,GUIManager.GUIEditWindowSize.y));
		}
		else
			EditorWindow.GetWindow(typeof(GUIManagerWindow));

		// get GUIManager
		if ( guiManager == null )
		{
			GameObject go = GameObject.Find ("GUIManager");
			if ( go != null )
			{
				guiManager = go.GetComponent<GUIManager>() as GUIManager;
				if ( guiManager != null )
				{
					guiManager.Fade = false;
				}
			}
		}
	}
示例#6
0
    public GUIRiver(GUIManager gm)
    {
        this.gm = gm;

        menuWidth = gm.menuWidth;
        rightMenuOffset = gm.rightOffset;
        topOffset = gm.topOffset;
        buttonHeight = gm.smallButtonHeight;
        sideOffset = 10;
        scaleY = gm.scaleY;
        visibleArea = gm.visibleArea;

        rg = gm.cm.riverGenerator;
        rg.riverGui = this;

        riverFlags = new List<bool>();

        //width = 15;
        //areaEffect = 1;
        //depth = 0.2f;

        defaultRiver = new RiverInfo(rg);
        defaultRiver.SetDefaultValues();
        selectedRiver = defaultRiver;
    }
示例#7
0
 void Awake()
 {
     if (instance == null)
             instance = this;
         else if (instance != null)
             Destroy (this);
 }
示例#8
0
 public TextBoxView(TextBox model, GUIManager manager)
     : base(model, manager)
 {
     m_CursorTimer = new Timer();
     m_CursorTimer.Elapsed += TimerElapsed;
     model.OnValueChanged += Model_OnValueChanged;
 }
 void Awake()
 {
     GameObject gameconobj = GameObject.FindGameObjectWithTag(Tags.gameController);
     gamecon = gameconobj.GetComponent<GameController>();
     gman = gameconobj.GetComponent<GUIManager>();
     buttonRect = new Rect(640, 216, 640, 648);
 }
示例#10
0
    public void Awake()
    {
        this.guiManager = (GUIManager) Camera.main.GetComponent("GUIManager");

        // Detect and parse any existing human units.

        GameObject[] humanUnitObjects = GameObject.FindGameObjectsWithTag(TagConstants.HUMANS);

        if (humanUnitObjects != null)
        {
            HumanUnit currentHumanUnit;

            for (int i = 0; i < humanUnitObjects.Length; i++)
            {
                currentHumanUnit = (HumanUnit) humanUnitObjects[i].GetComponent("HumanUnit");

                if (currentHumanUnit != null)
                {
                    this.humanUnits.Add(currentHumanUnit);
                }
                else
                {
                    Debug.LogError("Game Object " + humanUnitObjects[i].name + " is missing HumanUnit component.");
                }
            }
        }

        Debug.Log("Started with " + this.GetHumanCount() + " human units.");

        // Prevent units colliding with each other.
        int unitLayerMask = LayerMask.NameToLayer(LayerConstants.UNITS);
        Physics.IgnoreLayerCollision(unitLayerMask, unitLayerMask);
    }
    // Use this for initialization
    void Start()
    {
        EM = EventManager.Instance;
        gm = GameObject.FindGameObjectWithTag("GUIManager").GetComponent<GUIManager>();

        float w = back.width/2;
        float h = back.height/2;
        backr = new Rect(Screen.width-w, 0-h*0.1f, w, h);

        w = scenes.width/2;
        h = scenes.height/2;
        scenesr = new Rect(Screen.width - backr.width / 2 - w / 2 + 3, backr.height*0.15f, w,h);

        w = texts.width/2;
        h = texts.height/2;
        textsr = new Rect(Screen.width - backr.width / 2 - w / 2 + 7, backr.height*0.455f, w,h);

        toggles = new Dictionary<IconTypes, bool>();
        toggles[IconTypes.Alueet] = true;
        toggles[IconTypes.Tarinat] = true;
        // dafug : really?
        iconnames = new Dictionary<IconTypes, string>();
        iconnames[IconTypes.Alueet] = "scene";
        iconnames[IconTypes.Tarinat] = "text";

        gm.NormalGUIFuncs += DrawMenu;
    }
示例#12
0
    void Start()
    {
        worldManager = (WorldManager)FindObjectOfType (typeof(WorldManager));
        guiManager = (GUIManager)FindObjectOfType (typeof(GUIManager));

        characterMotor=worldManager.getPlayer().GetComponent<CharacterMotor>();
    }
示例#13
0
    public void InitModal( GUIManager.ModalType modalType, string strMessage,
							UIEventListener.VoidDelegate[] btnDelegates, 
							UIEventListener.VoidDelegate CommonBtnDelegate )
    {
        this.modalType = modalType;

        // set label
        if( messageLabel != null )
            messageLabel.text = strMessage;

        // set event handler
        if( buttonListeners.Length >= 1 ) {
            buttonListeners[0].onClick = btnDelegates[0];
            buttonListeners[0].onClick += CommonBtnDelegate;
        }

        if( buttonListeners.Length >= 2 ) {
            buttonListeners[1].onClick = btnDelegates[1];
            buttonListeners[1].onClick += CommonBtnDelegate;
        }

        if( buttonListeners.Length >= 3 ) {
            buttonListeners[2].onClick = btnDelegates[2];
            buttonListeners[2].onClick += CommonBtnDelegate;
        }
    }
    private void Start()
    {
        // Get the transform of the main camera to allow for camera-relative controls
        if (Camera.main != null)
        {
            cam = Camera.main.transform;
        }
        else
        {
            Debug.LogWarning(
                "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
        }

        // Initialize variables
        character = GetComponent<RobotCharacter>();
		ragdoll = GetComponent<RobotRagdoll>();
		particle = GetComponent<RobotParticleManager>();
		energy = GetComponent<RobotEnergy>();
		isoCam = Camera.main.GetComponent<IsometricCamera>();
		GM = GameObject.Find("GameManager").GetComponent<GameManager>();
		gui = GameObject.Find ("GUI").GetComponentInChildren<GUIManager>();
		entity = GetComponentInChildren<EntityRig>();
		crouch = false;
		guard = false;
		leftTriggerReleased = true;
		rightTriggerReleased = true;
		energy.StartEnergyDrain();
    }
示例#15
0
    public IEnumerator InitWaitModal( GUIManager.ModalType modalType, string strMessage, 
								float fDuration = 0.0f, System.Action waitCallBack = null )
    {
        this.modalType = modalType;

        this.fDuration = fDuration;
        this.fStartTime = Time.time;

        this.waitCallBack = waitCallBack;

        // set label
        if( messageLabel != null )
            messageLabel.text = strMessage;

        if( Time.time < fStartTime + fDuration ) {

            yield return null;
        }
        else {

            if( waitCallBack != null )
                waitCallBack();
        }

        GUIManager.Instance.modalDialogs.CurrentModal = null;
    }
示例#16
0
 void Awake()
 {
     if( s_instance == null )
         s_instance = this;
     else
         Destroy(this.gameObject);
 }
示例#17
0
	//setup
	void Awake()
	{
		gui = FindObjectOfType(typeof(GUIManager)) as GUIManager ;
		if(tag != "Coin")
		{
			tag = "Coin";
			Debug.LogWarning ("'Coin' script attached to object not tagged 'Coin', tag added automatically", transform);
		}
		GetComponent<Collider>().isTrigger = true;
		triggerParent = GetComponentInChildren<TriggerParent>();
		//if no trigger bounds are attached to coin, set them up
		if(!triggerParent)
		{
			GameObject bounds = new GameObject();
			bounds.name = "Bounds";
			bounds.AddComponent<SphereCollider>();
			bounds.GetComponent<SphereCollider>().radius = 7f;
			bounds.GetComponent<SphereCollider>().isTrigger = true;
			bounds.transform.parent = transform;
			bounds.transform.position = transform.position;
			bounds.AddComponent<TriggerParent>();
			triggerParent = GetComponentInChildren<TriggerParent>();
			triggerParent.tagsToCheck = new string[1];
			triggerParent.tagsToCheck[0] = "Player";
			Debug.LogWarning ("No pickup radius 'bounds' trigger attached to coin: " + transform.name + ", one has been added automatically", bounds);
		}
	}
示例#18
0
        public override void Init( GUIManager gui )
        {
            base.Init( gui );

            newGame.onClick.AddListener( OnNewGameButton );
            quit.onClick.AddListener( OnQuit );
        }
 void Awake()
 {
     appManager = GetComponent<AppManager>();
     guiManager = GetComponent<GUIManager>();
     gameplayManager = GetComponent<GameplayManager>();
     soundManager = GetComponent<SoundManager>();
 }
示例#20
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        Application.targetFrameRate = 60;

        m_players = new GameObject[2];

        if(GameObject.Find("PLAYER0"))
            m_players[0] = GameObject.Find("PLAYER0");
        else
            m_players[0] = GameObject.Find("PLAYER0_concept");

        if(GameObject.Find("PLAYER1"))
            m_players[1] = GameObject.Find("PLAYER1");
        else
            m_players[1] = GameObject.Find("PLAYER1_concept");

        targetCameraManager = GameObject.Find("TargetCamera");
        num_levels = PlayerPrefs.GetInt("num_levels");

        if(bConcept)
            triangle = (GameObject)Instantiate(Resources.Load("triangle", typeof(GameObject)));

        guiManager = GetComponent<GUIManager>();
        scoreManager = GetComponent<ScoreManager>();

        goAudioManager = GameObject.Find("goAudioManager");
    }
示例#21
0
	// Use this for initialization
	void Start () {
		instance = this;

		player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();

		GameObject mapCameraObj = GameObject.FindGameObjectWithTag ("mapCamera");
		if(mapCameraObj != null){
			mapCamera = mapCameraObj.GetComponent<Camera>();
			mapCamera.enabled = false;
		}

		GUITexture[] hudGUIs = GetComponentsInChildren<GUITexture>();
		powerImg = hudGUIs[0];
		crosshairImg = hudGUIs[1];
		matchImg = hudGUIs[2];
		if (mapCamera != null) {
			gunCrosshairImg = hudGUIs [3];
		}

		GUIText[] guiText = GetComponentsInChildren<GUIText>();
		hintsText = guiText[0];

		if (mapCamera != null) {
			hpText = guiText [1];
			bulletText = guiText [2];
			hiScoreText = guiText [3];
			scoreText = guiText [4];
		}

		HideCursor();
		SetHiScore(hiScore);
	}
示例#22
0
 public static GUIManager getInstance()
 {
     if(_instance == null)
     {
         _instance = GameObject.FindObjectOfType<GUIManager>();
     }
     return _instance;
 }
示例#23
0
 void Awake()
 {
     if (it != this)
     {
         it = this;
         Init();
     }
 }
示例#24
0
 protected override void Awake()
 {
     base.Awake();
     gman = GameObject.FindGameObjectWithTag(Tags.gameController)
         .GetComponent<GUIManager>();
     bossBack = Util.makeSolid(new Color32(0x46, 0x0a, 0x04, 0xff));
     bossFore = Util.makeSolid(new Color32(0xc8, 0x14, 0x14, 0xff));
 }
    void Awake()
    {
        DontDestroyOnLoad(gameObject);

        inputManager = GetComponent<InputManager>();
        guiManager = GetComponent<GUIManager>();
        gameplayManager = GetComponent<GameplayManager>();
    }
 public override void OnLoad()
 {
     _guiManager = GUIManager.getInstance();
     _pluginLoader = new HotPluginLoader(_pluginsPath, PluginLoaderWriteLine);
     
     WriteLine("Root Loader - Loaded");
     _pluginLoader.OnLoad();
 }
示例#27
0
    // Use this for initialization
    void Start()
    {
        buttonWidth = Screen.width /16.005f;
        buttonHeight = Screen.height / 9.75f;
        buttonPadding = Screen.height / 9.75f;

        Instance = this;
        Player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMove>();

        comboMeter = this.gameObject.AddComponent<GUIText>();
        comboMeter.fontSize =46;
        comboMeter.fontStyle = FontStyle.Bold;
        comboMeter.alignment = TextAlignment.Center;
        comboMeter.anchor = TextAnchor.MiddleCenter;
        comboMeter.color = Color.yellow;

        if (ComboFont != null)
        {
            comboMeter.font = ComboFont;
        }

        //Debug.Log("width " + Screen.height);
        buttonPadding = 1f;
        buttons[0] = new GameObject("Sword");
        buttons[1] = new GameObject("Hammer");
        buttons[2] = new GameObject("Bow");
        buttons[3] = new GameObject("Spear");
        buttons[4] = new GameObject("Axe");
        touchZones = new Rect[buttons.Length];
        for (int i = 0; i < buttons.Length; i++)
        {
            buttonRect=new Rect(firstButtonPos.x,
                firstButtonPos.y+i*(buttonHeight+buttonPadding),
            buttonWidth,buttonHeight);
            //buttonRect = new Rect(-64, -64, 81, 81);
            buttons[i].AddComponent("GUITexture");
            buttons[i].guiTexture.texture = guiTextures[i];
            buttons[i].guiTexture.pixelInset = buttonRect;

            //buttons[i].transform.position = new Vector3(
            //    firstButtonPos.x + i * (buttonWidth + buttonPadding),
            //    firstButtonPos.y ,    firstButtonPos.z);
            buttons[i].transform.position = Vector3.zero;
            buttons[i].transform.localScale = Vector3.zero;
            touchZones[i] = new Rect(buttonRect);
        }

        healthIcons = new GameObject[Player.health];

        for (int i = 0; i < Player.health; i++)
        {
            healthIcons[i] =  new GameObject();
            GUITexture texture = healthIcons[i].AddComponent<GUITexture>();
            texture.guiTexture.texture = healthIcon.guiTexture.texture;
            texture.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
            texture.transform.position = new Vector3(0.05f + (i * 0.05f), 0.95f, 0.0f);
        }
    }
示例#28
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    void Awake()
    {
        gameManagerObj = GameObject.Find("_GAMEMANAGER");
        guiManager = gameManagerObj.GetComponent<GUIManager>();

        targetCamera = GameObject.Find("TargetCamera").transform;

        targetPos = new Vector3(transform.position.x, transform.position.y-0.5f, transform.position.z);
    }
示例#29
0
	// Use this for initialization
	void Start(){


		GameObject GUIManagerObject = GameObject.Find ("GUIManager");
		gui = GUIManagerObject.GetComponent("GUIManager") as GUIManager;
		populateDefault ();
		doChangeClub ();

	}
示例#30
0
    public GUIMenu(GUIManager gm)
    {
        this.gm = gm;

        menuWidth = gm.menuWidth;
        rightOffset = gm.rightOffset;
        topOffset = gm.topOffset;
        buttonHeight = gm.menuButtonHeight;
    }
示例#31
0
 // Use this for initialization
 void Start()
 {
     playerScript_ = GameObject.Find("Player").GetComponent <PlayerScript> ();
     guiManager_   = this.GetComponent <GUIManager> ();
     scoreManager_ = this.GetComponent <ScoreManager> ();
 }
示例#32
0
 private void OnClick(GameObject go)
 {
     if (go == panel.equipBtn.gameObject)
     {
         if (currentType != ItemType.Equip)
         {
             batchSell = false;
             SellBtn(batchSell);
             sellList.Clear();
             currentType = ItemType.Equip;
             panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
         }
     }
     else if (go == panel.consueBtn.gameObject)
     {
         if (currentType != ItemType.ConSue)
         {
             batchSell = false;
             SellBtn(batchSell);
             sellList.Clear();
             currentType = ItemType.ConSue;
             panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
         }
     }
     else if (go == panel.materialBtn.gameObject)
     {
         if (currentType != ItemType.Material)
         {
             batchSell = false;
             SellBtn(batchSell);
             sellList.Clear();
             currentType = ItemType.Material;
             panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
         }
     }
     else if (go == panel.gemBtn.gameObject)
     {
         if (currentType != ItemType.Gem)
         {
             batchSell = false;
             SellBtn(batchSell);
             sellList.Clear();
             currentType = ItemType.Gem;
             panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
         }
     }
     else if (go == panel.batchSellBtn.gameObject)
     {
         if (bagList.Count < 1)
         {
             GUIManager.SetPromptInfo(TextManager.GetUIString("UIBag"), null);
         }
         else
         {
             batchSell = true;
             sellList.Clear();
             SellBtn(batchSell);
             panel.BagGrid.UpdateCustomDataList(AddListGrid(bagList));
         }
     }
     else if (go == panel.oKSellBtn.gameObject)
     {
         if (sellList.Count <= 0)
         {
             GUIManager.SetPromptInfo(TextManager.GetUIString("UIBag1"), SetBtn);
             return;
         }
         batchSell = false;
         SellBtn(batchSell);
         panel.batchSell.gameObject.SetActive(true);
         List <object> listObj = new List <object>();;
         int           Price   = 0;
         for (int i = 0; i < sellList.Count; i++)
         {
             listObj.Add(sellList[i] as object);
             ItemInfo item = ItemManager.GetItemInfo((sellList[i] as Item).itemID);
             Price += item.itemPrice * (sellList[i] as Item).amount;
         }
         panel.Price.text = string.Format(TextManager.GetUIString("UIBatchPrice"), Price);
         panel.SellGrid.AddCustomDataList(listObj);
     }
     else if (go == panel.yesSellBtn.gameObject)
     {
         List <object> baguuid = new List <object>();
         for (int i = 0; i < sellList.Count; ++i)
         {
             baguuid.Add(UInt64.Parse((sellList[i] as Item).uuid));
             for (int j = bagList.Count - 1; j >= 0; j--)
             {
                 if (bagList[j].uuid == (sellList[i] as Item).uuid)
                 {
                     bagList.Remove(bagList[j]);
                 }
             }
         }
         sellList.Clear();
         panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
         ServerCustom.instance.SendClientMethods("onClientSellBatch", baguuid);
         panel.batchSell.gameObject.SetActive(false);
     }
     else if (go == panel.noSellBtn.gameObject)
     {
         batchSell = false;
         SellBtn(batchSell);
         panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
         panel.batchSell.gameObject.SetActive(false);
     }
     else if (go == panel.cancelSellBtn.gameObject)
     {
         batchSell = false;
         SellBtn(batchSell);
         sellList.Clear();
         panel.BagGrid.AddCustomDataList(AddListGrid(bagList));
     }
     else if (go == panel.backBtn.gameObject)
     {
         Facade.SendNotification(NotificationID.Bag_Hide);
     }
     else if (go == panel.addBagBtn.gameObject)
     {
         panel.addBagSize.gameObject.SetActive(true);
         panel.changeNum.text   = "1";
         panel.needDiamond.text = string.Format(TextManager.GetUIString("UIBasize1"), bagSizeInfo.needDimaond);
     }
     else if (go == panel.minBtn.gameObject)
     {
         panel.changeNum.text   = "1";
         panel.needDiamond.text = string.Format(TextManager.GetUIString("UIBasize1"), bagSizeInfo.needDimaond);
     }
     else if (go == panel.maxBtn.gameObject)
     {
         panel.changeNum.text   = bagSizeInfo.maxSize.ToString();
         panel.needDiamond.text = string.Format(TextManager.GetUIString("UIBasize1"), bagSizeInfo.maxSize * bagSizeInfo.needDimaond).ToString();
     }
     else if (go == panel.yesAddSize.gameObject)
     {
         // 背包扩容
         panel.addBagSize.gameObject.SetActive(false);
         ServerCustom.instance.SendClientMethods("onClientBuyBagSize", UtilTools.IntParse(panel.changeNum.text));
     }
     else if (go == panel.noAddSize.gameObject)
     {
         panel.addBagSize.gameObject.SetActive(false);
     }
 }
示例#33
0
 void Awake()
 {
     instance      = GetComponent <GUIManager>();
     boardManager  = GameObject.Find("BoardManager");
     choosingSkill = false;
 }
示例#34
0
 public void TestShowGUI2()
 {
     GUIManager.CloseGUI <UIOne>(UIOne.Instance);
 }
示例#35
0
        public virtual void OnClickSquare()
        {
            if (!IsEnabled || !HasStack)
            {
                return;
            }
            if (InterfaceActionManager.LastMouseClick == 1)
            {
                OnRightClickSquare();
                return;
            }

            WIStackError error      = WIStackError.None;
            bool         playSound  = false;
            bool         splitStack = false;
            bool         quickAdd   = false;
            string       soundName  = "InventoryPlaceStack";
            //skill usage
            bool useSkillToRemove = false;

            //left clicking can pick up, split, or quick-add
            if (InterfaceActionManager.Get.IsKeyDown(InterfaceActionType.StackSplit))
            {
                splitStack = true;
            }                                    /* else if (AllowShiftClick && InterfaceActionManager.Get.IsKeyDown (InterfaceActionType.StackQuickAdd)) {
                                                  *             quickAdd = true;
                                                  * }*/

            mRemoveItemSkillNames.Clear();

            if (mStack.HasOwner(out mSkillUseTarget))
            {
                //SKILL USE
                if (mSkillUseTarget.UseRemoveItemSkill(mRemoveItemSkillNames, ref mSkillUseTarget))
                {
                    useSkillToRemove = true;
                    quickAdd         = false;
                }
            }

            WIStack selectedStack = Player.Local.Inventory.SelectedStack;

            if (mStack.HasTopItem)
            {
                //if our stack has items
                if (selectedStack.HasTopItem)
                {
                    //and the selected stack ALSO has items
                    //------Special cases------//
                    //LIQUID CONTAINER CHECK - can we put the thing we're holding into the thing we've clicked?
                    if (FillLiquidContainer(mStack.TopItem, selectedStack.TopItem, selectedStack))
                    {
                        playSound = true;
                        soundName = "FillLiquidContainer";
                    }
                    else if (Stacks.Can.Stack(mStack.TopItem, selectedStack.TopItem))
                    {
                        //if the selected stack's items can stack with our stack's items,
                        //then we're putting items IN the stack
                        //this is only allowed if the stack isn't owned
                        if (useSkillToRemove)
                        {
                            //play an error and get out
                            MasterAudio.PlaySound(MasterAudio.SoundType.PlayerInterface, SoundNameFailure);
                            return;
                        }
                        else
                        {
                            //otherwise try to add the items normally
                            playSound = Stacks.Add.Items(selectedStack, mStack, ref error);
                        }
                    }
                    else
                    {
                        //if the selected stack's items can't be stacked
                        //then we're swapping the stack
                        //ie, we're removing items FROM the stack
                        //this is only allowed if the stack isn't owned
                        if (useSkillToRemove)
                        {
                            //so play an error and get out
                            MasterAudio.PlaySound(MasterAudio.SoundType.PlayerInterface, SoundNameFailure);
                            return;
                        }
                        else
                        {
                            //otherwise try to swap stacks normally
                            playSound = Stacks.Swap.Stacks(mStack, selectedStack, ref error);
                        }
                    }
                }
                else
                {
                    //----SHIFT CLICK CHECK----//
                    //check for shift click - this bypasses everything and adds the item to the player's inventory
                    //this only works if the stack does not already belong to the player's group
                    if (quickAdd)
                    {
                        //Debug.Log ("Starting quick add..");
                        if (Player.Local.Inventory.CanItemFit(mStack.TopItem))
                        {
                            if (Player.Local.Inventory.QuickAddItems(mStack, ref error))
                            {
                                soundName = "InventoryPickUpStack";
                                playSound = true;
                            }
                        }
                        else
                        {
                            GUIManager.PostWarning(mStack.TopItem.DisplayName + " won't fit in your inventory");
                        }
                    }
                    else
                    {
                        //if the selected stack does NOT have any items
                        //we're putting items IN the stack
                        if (splitStack && mStack.NumItems > 1)
                        {
                            //we're splitting the stack and adding the contents to the selected stack
                            //this is only allowed if the stack isn't owned
                            if (useSkillToRemove)
                            {
                                //play an error and get out
                                MasterAudio.PlaySound(MasterAudio.SoundType.PlayerInterface, SoundNameFailure);
                                return;
                            }
                            int  numToAdd  = mStack.NumItems / 2;
                            bool addResult = true;
                            //IWIBase topItem = null;
                            for (int i = 0; i < numToAdd; i++)
                            {
                                if (!Stacks.Pop.AndPush(mStack, selectedStack, ref error))
                                {
                                    addResult = false;
                                    break;
                                }
                            }
                            playSound = addResult;
                        }
                        else
                        {
                            //if we're not splitting stacks
                            //THIS is where we finally REMOVE items from this stack using a skill
                            if (useSkillToRemove)
                            {
                                UseSkillsToRemoveStack();
                                return;
                            }
                            else if (Stacks.Add.Items(mStack, selectedStack, ref error))
                            {
                                playSound = true;
                                soundName = "InventoryPickUpStack";
                            }
                        }
                    }
                }
            }
            else if (selectedStack.HasTopItem)
            {
                //if our stack does NOT have items
                //we're adding items TO our stack
                //this is only allowed if the stack isn't owned
                if (useSkillToRemove)
                {
                    //so play an error and get out
                    MasterAudio.PlaySound(MasterAudio.SoundType.PlayerInterface, SoundNameFailure);
                    return;
                }
                else if (Stacks.Add.Items(selectedStack, mStack, ref error))
                {
                    //otherwise try to add the items and get out
                    playSound = true;
                }
            }

            if (error != WIStackError.None)
            {
                GUIManager.PostStackError(error);
            }

            if (playSound)
            {
                MasterAudio.PlaySound(MasterAudio.SoundType.PlayerInterface, soundName);
            }

            UpdateDisplay();
        }
示例#36
0
 void OnBattleBtnClick()
 {
     GameStateManager.LoadScene(3);
     GUIManager.ShowView("LoadingPanel");
     LoadingPanel.LoadingName = "BattleUIPanel";
 }
示例#37
0
    // Token: 0x06001403 RID: 5123 RVA: 0x00233E20 File Offset: 0x00232020
    public void InitTextObj(ushort Count)
    {
        GUIManager instance = GUIManager.Instance;

        this.TextObjCount = Count;
        Font ttffont = instance.GetTTFFont();

        this.TextmeshArray  = new MeshRenderer[(int)(Count * 5)];
        this.TextObjPool    = new GameObject[(int)this.TextObjCount];
        this.TextObjPool[0] = new GameObject("Stage");
        this.TextObjPool[0].AddComponent <SpriteRenderer>();
        GameObject   gameObject = new GameObject("Text");
        TextMesh     textMesh   = gameObject.AddComponent <TextMesh>();
        MeshRenderer component  = gameObject.GetComponent <MeshRenderer>();

        component.castShadows    = false;
        component.receiveShadows = false;
        this.TextmeshArray[0]    = component;
        textMesh.font            = ttffont;
        textMesh.fontSize        = 18;
        textMesh.richText        = false;
        Material material = new Material(ttffont.material);

        material.shader                 = Shader.Find("UI/Default Font");
        textMesh.renderer.material      = material;
        component.renderer.sortingOrder = -20;
        gameObject.transform.SetParent(this.TextObjPool[0].transform);
        this.TextObjPool[0].SetActive(false);
        for (byte b = 0; b < 4; b += 1)
        {
            GameObject gameObject2 = new GameObject("outline", new Type[]
            {
                typeof(TextMesh)
            });
            textMesh = gameObject2.GetComponent <TextMesh>();
            this.TextmeshArray[(int)(1 + b)] = gameObject2.GetComponent <MeshRenderer>();
            textMesh.fontSize = 18;
            component         = gameObject2.GetComponent <MeshRenderer>();
            component.renderer.sortingOrder = -30;
            component.castShadows           = false;
            component.receiveShadows        = false;
            component.material = material;
            textMesh.font      = ttffont;
            textMesh.richText  = false;
            gameObject2.transform.SetParent(gameObject.transform);
            textMesh.color = Color.black;
        }
        byte b2 = 1;

        while ((ushort)b2 < this.TextObjCount)
        {
            this.TextObjPool[(int)b2] = (UnityEngine.Object.Instantiate(this.TextObjPool[0]) as GameObject);
            this.TextObjPool[(int)b2].SetActive(false);
            this.TextmeshArray[(int)(5 * b2)] = this.TextObjPool[(int)b2].transform.GetChild(0).GetComponent <MeshRenderer>();
            for (byte b3 = 0; b3 < 4; b3 += 1)
            {
                this.TextmeshArray[(int)(5 * b2 + 1 + b3)] = this.TextObjPool[(int)b2].transform.GetChild(0).GetChild((int)b3).GetComponent <MeshRenderer>();
            }
            b2 += 1;
        }
    }
示例#38
0
 protected override void OnLoadComplete()
 {
     GUIManager.ShowView("PlayerPanel");
 }
示例#39
0
    // Token: 0x06002BEE RID: 11246 RVA: 0x004833D0 File Offset: 0x004815D0
    public unsafe override void OnOpen(int arg1, int arg2)
    {
        DataManager instance  = DataManager.Instance;
        GUIManager  instance2 = GUIManager.Instance;

        this.QueueBar = (EQueueBarIndex)arg2;
        this.TimeStr  = StringManager.Instance.SpawnString(200);
        this.HelpStr  = StringManager.Instance.SpawnString(30);
        base.OnOpen(arg1, arg2);
        this.ThisTransform = base.SetFunc(this.transform.GetChild(3));
        Font ttffont = GUIManager.Instance.GetTTFFont();

        this.ThisTransform.gameObject.SetActive(true);
        this.MainText.font = ttffont;
        this.HelpObj       = this.ThisTransform.GetChild(1).gameObject;
        this.HelpText      = this.ThisTransform.GetChild(1).GetChild(1).GetComponent <UIText>();
        this.HelpText.font = ttffont;
        base.AddRefreshText(this.HelpText);
        UIButtonHint uibuttonHint = this.ThisTransform.GetChild(1).gameObject.AddComponent <UIButtonHint>();

        uibuttonHint.m_DownUpHandler = this;
        uibuttonHint.Parm1           = 14701;
        uibuttonHint.m_eHint         = EUIButtonHint.DownUpHandler;
        bool           active   = true;
        EQueueBarIndex queueBar = this.QueueBar;

        switch (queueBar)
        {
        case EQueueBarIndex.Training:
            this.Speedup = new TrainingSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.HeroEnhance:
            this.Speedup = new HeroEnhanceSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.HeroEvolution:
            this.Speedup = new HeroStarupSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.Treatmenting:
            this.Speedup = new TreatmentingSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.Manufacturing:
            this.Speedup = new TrapSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.TrapRepair:
            this.Speedup = new FixTrapSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.WallRepair:
            this.Speedup = new FixwallSpeedup(this.QueueBar);
            break;

        default:
            if (queueBar != EQueueBarIndex.Building)
            {
                if (queueBar != EQueueBarIndex.Researching)
                {
                    active        = false;
                    this.Speedup  = new MarchGropSpeedup(arg2);
                    this.QueueBar = (EQueueBarIndex)this.Speedup.QueueBar;
                    if (this.Speedup.QueueBar == 255)
                    {
                        MarchGropSpeedup marchGropSpeedup = this.Speedup as MarchGropSpeedup;
                        if (marchGropSpeedup.mapline != null && marchGropSpeedup.mapline.lineFlag != 12)
                        {
                            this.bException = true;
                        }
                    }
                }
                else
                {
                    this.Speedup = new ResearchSpeedup(this.QueueBar);
                    this.CheckHelpbarShow();
                }
            }
            else
            {
                this.Speedup = new BuildSpeedup(this.QueueBar);
                this.CheckHelpbarShow();
            }
            break;

        case EQueueBarIndex.Forging:
            this.Speedup = new ForgingSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.AffairMission:
            this.Speedup = new MissionAffairSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.AllianceMission:
            this.Speedup = new MissionAllianceSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.VIPMission:
            this.Speedup = new MissionVIPSpeedup(this.QueueBar);
            break;

        case EQueueBarIndex.LordReturn:
            this.Speedup = new HeroLeavePrison(this.QueueBar);
            break;

        case EQueueBarIndex.PetFusion:
            this.Speedup = new PetItemCraftSpeed(this.QueueBar);
            break;

        case EQueueBarIndex.PetEvolution:
            this.Speedup = new PetEvolutionSpeed(this.QueueBar);
            break;
        }
        this.SortObj.SetActive(active);
        this.UseTargetID   = (ushort)this.Speedup.UseTarget;
        this.MainText.text = this.Speedup.MainTitleStr;
        string text  = string.Empty;
        string empty = string.Empty;

        this.timebar = this.ThisTransform.GetChild(0).GetComponent <UITimeBar>();
        instance.GetQueueBarTitle(this.QueueBar, instance2.tmpString, ref text, ref empty);
        instance2.CreateTimerBar(this.timebar, 0L, 0L, 0L, eTimeBarType.SpeedupType, text, empty);
        if (arg2 < 100)
        {
            if (this.QueueBar >= (EQueueBarIndex)instance.queueBarData.Length)
            {
                this.bForceClose = 1;
                this.ThisTransform.gameObject.SetActive(false);
                return;
            }

            fixed(QueueBarData *ptr = &instance.queueBarData[(int)((byte)this.QueueBar)])
            {
                instance2.SetTimerBar(this.timebar, ptr->StartTime, ptr->StartTime + (long)((ulong)ptr->TotalTime), 0L, eTimeBarType.SpeedupType, text, empty);
                this.LeftTime = ptr->StartTime + (long)((ulong)ptr->TotalTime) - instance.ServerTime;
            }
        }
        else
        {
            text = instance.mStringTable.GetStringByID(4914u);
            if (this.Speedup.Name != null)
            {
                this.CheckNameID = this.Speedup.Name.GetHashCode(false);
            }
            instance2.SetTimerBar(this.timebar, this.Speedup.StartTime, this.Speedup.StartTime + (long)((ulong)this.Speedup.TotalTime), 0L, eTimeBarType.SpeedupType, text, text);
            this.LeftTime = this.Speedup.StartTime + (long)((ulong)this.Speedup.TotalTime) - instance.ServerTime;
        }
        if (this.LeftTime < 0L)
        {
            this.bForceClose = 1;
            this.ThisTransform.gameObject.SetActive(false);
        }
        if (this.Speedup.bFreeSpeedup && this.LeftTime <= (long)instance.GetFreeCompleteTime())
        {
            this.bUseImmediateFree = true;
        }
        else
        {
            this.bUseImmediateFree = false;
        }
        if (!this.bUseImmediateFree)
        {
            if (!this.Speedup.bImmediate)
            {
                this.MoneyIdx = -1;
            }
            else
            {
                this.MoneyIdx = 0;
            }
            if (this.Speedup.bFreeSpeedup)
            {
                this.FreeIdx = 1;
            }
            else
            {
                this.FreeIdx = -1;
            }
        }
        else
        {
            this.MoneyIdx = -1;
            this.FreeIdx  = 0;
            instance2.SetTimerSpriteType(this.timebar, eTimerSpriteType.Free);
        }
    }
示例#40
0
    private void Awake()
    {
        #region <Pattern Setup>
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        #endregion

        GameModeManager = transform.Find("GameModeManager").gameObject.GetComponent <GameModeManagerScript>();

        SupplierManager      = GetComponent <SupplierManager>();
        CustomerManager      = GetComponent <CustomerManager>();
        OrderManager         = GetComponent <OrderManager>();
        ItemManager          = GetComponent <ItemManager>();
        CustomizationManager = GetComponent <CustomizationManager>();
        GUIManager           = GetComponent <GUIManager>();
        NPCManager           = GetComponent <NPCManager>();
        AchievementManager   = GetComponent <AchievementManager>();
        UpgradeManager       = GetComponent <UpgradeManager>();
        DBManager            = GetComponent <DatabaseManager>();

        #region <Validate Game Save File Name & Extension>
        string tempSaveFileName, tempSaveFileExtension;

        //NAME:
        tempSaveFileName = "";

        for (int i = 0; i < SaveFileName.Length; i++)
        {
            if (Char.IsLetterOrDigit(SaveFileName[i]))
            {
                tempSaveFileName += SaveFileName[i];
            }
        }

        //EXTENSION:
        tempSaveFileExtension = ".";

        if (SaveFileExtension[0] != '.')
        {
            SaveFileExtension = '.' + SaveFileExtension;
        }

        for (int i = 1; i < SaveFileExtension.Length; i++)
        {
            if (Char.IsLetter(SaveFileExtension[i]))
            {
                tempSaveFileExtension += Char.ToLower(SaveFileExtension[i]);
            }
        }

        //FINALLY:
        SaveFileName      = tempSaveFileName;
        SaveFileExtension = tempSaveFileExtension;
        #endregion

        #region <Validate Init Date & Time>
        if (initGameDateYear == 0)
        {
            initGameDateYear = DateTime.Today.Year;
        }
        if (initGameDateMonth == 0)
        {
            initGameDateMonth = DateTime.Today.Month;
        }
        if (initGameDateDay == 0)
        {
            initGameDateDay = DateTime.Today.Day;
        }
        #endregion

        currentMessage = MSG_GEN_NA;

        string sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
        if (sceneName == "MainMenu")
        {
            IsMainMenu = true;
        }
        else if (sceneName == "Main")
        {
            IsMainMenu = false;
        }
    }
示例#41
0
 public void GradientFinished(Gradient finishedGradient)
 {
     GUIManager.BlockInput(false);
 }
示例#42
0
 void Start()
 {
     objectiveManager = dontDestroy.currentGameManager.GetComponent <ObjectiveManager> ();
     guiManager       = dontDestroy.currentGameManager.GetComponent <GUIManager>();
 }
示例#43
0
 // Use this for initialization
 void Awake()
 {
     _inv = InventoryHandler.Instance();
     _characterManager = CharacterManager.Instance();
     _GUIManager       = GUIManager.Instance();
 }
示例#44
0
 void Awake()
 {
     Instance = this;
 }
示例#45
0
 private void Awake()
 {
     gui = FindObjectOfType <GUIManager>();
     initGUI();
 }
示例#46
0
 public void Awake()
 {
     Instance     = this;
     _audioSource = GetComponent <AudioSource>();
 }
示例#47
0
 void OnCardsGroundBtnClick()
 {
     GUIManager.ShowView("CardsPanel");
 }
示例#48
0
 void Awake()
 {
     GUIManager.instance = this;
 }
 void Start()
 {
     statsMan = GameObject.Find("_GameManager").GetComponent <StatsManager>();
     guiMan   = GameObject.Find("_GameManager").GetComponent <GUIManager>();
     soundMan = GameObject.Find("_SoundManager").GetComponent <SoundManager>();
 }
示例#50
0
 public static void FinishLoading()
 {
     GUIManager.LoadingPercent(100);
     GUIManager.instance.Loading.CloseLoading();
 }
示例#51
0
 public override void Leave()
 {
     GUIManager.DestroyAllView();
 }
示例#52
0
 public override void Leave()
 {
     GUIManager.Get().ClearGUI();
     CameraManager.Get().Clear();
 }
示例#53
0
 public void TestShowGUI1()
 {
     GUIManager.ShowGUI <UIOne>(UIOne.Instance, "UIOne");
 }
示例#54
0
文件: Eat.cs 项目: Zahorack/unity
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == Tag)
        {
            if (other.gameObject.transform.localScale.x < transform.localScale.x + 10)
            {
                if (transform.localScale.x <= 50)
                {
                    if (eatEffect != null)
                    {
                        eatEffect.Play();
                    }

                    if (other.gameObject.transform.localScale.x > 10)
                    {
                        float inc = 1; //other.gameObject.transform.localScale.x;
                        if (other.gameObject.transform.localScale.x > 20)
                        {
                            inc = 2;
                        }
                        else if (other.gameObject.transform.localScale.x > 20)
                        {
                            inc = 2;
                        }
                        else if (other.gameObject.transform.localScale.x > 30)
                        {
                            inc = 3;
                        }
                        else if (other.gameObject.transform.localScale.x > 40)
                        {
                            inc = 4;
                        }

                        if ((transform.localScale.x) <= 50)
                        {
                            transform.localScale += new Vector3(inc, inc, inc);
                        }
                    }
                    else
                    {
                        transform.localScale += new Vector3(Increase, Increase, Increase);
                    }
                }

                Destroy(other.gameObject);
            }


            Score        = transform.localScale.x - 7;
            Letters.text = "SCORE: " + Score;
        }

        if (other.gameObject.tag == "Player")
        {
            if (transform.localScale.x > (other.gameObject.transform.localScale.x + 2))
            {
                GUIManager gui = FindObjectOfType <GUIManager>();
                gui.Lose();
                //SceneManager.LoadScene(1);
            }
        }
    }
示例#55
0
 void Start()
 {
     lm = GameObject.Find("Level Manager").GetComponent <LevelManager>();
     gm = GameObject.Find("GUI Manager").GetComponent <GUIManager> ();
 }
示例#56
0
        public void onControllerEvent(ControllerEventArgs args)
        {
            // # Avoid responding controller event when inactive
            if (!active)
            {
                return;
            }

            // # Normal threatment
            // Multiple controller events only give one launch result per tick
            if (toLaunch == null)
            {
                // If options received (from entities)
                if (args.options != null)
                {
                    // If there's only one, proceed to launch
                    if (args.options.Length == 1)
                    {
                        // The action is the event we have to launch,
                        // so in order to know who's launching, we put a mark
                        if (args.options[0].Action != null)
                        {
                            args.options[0].Action.setParameter("Executer", this.Entity);
                        }

                        actionCell   = args.cell;
                        actionEntity = args.entity;

                        // If we've to move to perform the action
                        if (args.options[0].HasToMove)
                        {
                            GameEvent ge = new GameEvent();
                            ge.setParameter("mover", this.Entity.mover);
                            ge.setParameter("follow", args.entity);
                            ge.setParameter("distance", args.options[0].Distance);
                            ge.setParameter("synchronous", true);
                            ge.Name     = "follow";
                            movement    = ge;
                            movingArrow = false;
                            Game.main.enqueueEvent(ge);

                            // Here we've launched the movement. As it's synchronous, we'll receive
                            // the movement finished when the Mover considers it's done.
                        }

                        toLaunch = args.options[0].Action;
                    }
                    // If there're multiple actions we have to display a menu so player can choose
                    else if (args.options.Length > 1)
                    {
                        OptionsGUI gui = ScriptableObject.CreateInstance <OptionsGUI>();
                        gui.init(args, Camera.main.WorldToScreenPoint(args.entity.transform.position), args.options);
                        GUIManager.addGUI(gui, 100);
                    }
                }
                // If the argument doesn't contain options but it has a cell, we'll try to move over there
                else if (args.cell != null)
                {
                    var cell = args.cell;
                    if (args.cell.VirtualNeighbors.Count > 0)
                    {
                        cell = args.cell.VirtualNeighbors[0].Destination;
                    }

                    GameEvent ge = new GameEvent();
                    ge.setParameter("mover", this.Entity.mover);
                    ge.setParameter("cell", cell);
                    ge.Name = "move";
                    Game.main.enqueueEvent(ge);
                }
                // Otherwise, the controller event should contain keys pressed
                else
                {
                    int to = -1;
                    if (args.LEFT)
                    {
                        to = 0;
                    }
                    else if (args.UP)
                    {
                        to = 1;
                    }
                    else if (args.RIGHT)
                    {
                        to = 2;
                    }
                    else if (args.DOWN)
                    {
                        to = 3;
                    }

                    if (to > -1)
                    {
                        if (movement == null || !movingArrow)
                        {
                            if (Entity == null)
                            {
                                Debug.Log("Null!");
                            }
                            Cell destination = Entity.Position.Map.getNeightbours(Entity.Position)[to];
                            // Can move to checks if the entity can DIRECT move to this cells.
                            // This should solve bug #29
                            Mover em = this.Entity.GetComponent <Mover>();
                            if (em != null && em.CanMoveTo(destination))
                            {
                                GameEvent ge = new GameEvent();
                                ge.setParameter("mover", this.Entity.mover);
                                ge.setParameter("cell", destination);
                                ge.setParameter("synchronous", true);
                                ge.Name = "move";
                                Game.main.enqueueEvent(ge);
                                movement = ge;
                            }
                            else
                            {
                                GameEvent ge = new GameEvent();
                                ge.setParameter("mover", this.Entity.mover);
                                ge.setParameter("direction", fromIndex(to));
                                ge.setParameter("synchronous", true);
                                ge.Name = "turn";
                                Game.main.enqueueEvent(ge);
                                movement = ge;
                            }
                            movingArrow = true;
                        }
                    }
                }
            }
        }
示例#57
0
    public override void draw()
    {
        float anchoGUI = Screen.width,
              altoGUI  = Screen.height;

        GUI.BeginGroup(new Rect(0, 0, anchoGUI, altoGUI), "Inventory");
        GUI.Box(new Rect(0, 0, anchoGUI, altoGUI), "");
        GUIStyle style = new GUIStyle();

        style.padding = new RectOffset(15, 15, 15, 15);

        GUI.BeginGroup(new Rect(0, 0, anchoGUI, 150));
        GUI.Label(new Rect(0, 0, anchoGUI, 150), "Inventory");
        GUI.EndGroup();

        // Filtramos los item
        Dictionary <Item, int> cantidades = new Dictionary <Item, int> ();

        foreach (Item i in this.inventory.Items)
        {
            bool encontrado = false;
            foreach (Item clave in cantidades.Keys)
            {
                if (clave.isEqualThan(i))
                {
                    cantidades[clave]++;
                    encontrado = true;
                    break;
                }
            }
            if (!encontrado)
            {
                cantidades.Add(i, 1);
            }
        }



        float itemYPos    = 0;
        float itemHeight  = 50;
        float anchoScroll = anchoGUI - 40;

        scroll = GUI.BeginScrollView(new Rect(10, 50, anchoGUI - 20, altoGUI - 150), scroll,
                                     new Rect(0, 0, anchoScroll, itemHeight * cantidades.Count));
        foreach (Item i in cantidades.Keys)
        {
            //Cada item
            if (GUI.Button(new Rect(0, itemYPos, anchoScroll, itemHeight), "", GUIStyle.none) && optionsGUI == null)
            {
                GameEvent use = new GameEvent();
                use.Name = "use item";
                use.setParameter("inventory", this.inventory);
                use.setParameter("item", i);
                GameEvent remove = new GameEvent();
                remove.Name = "remove item";
                remove.setParameter("inventory", this.inventory);
                remove.setParameter("item", i);
                OptionsToCreate = new Option[] { new Option("Use", use, false, 0), new Option("Remove", remove, false, 0) };
            }

            GUI.BeginGroup(new Rect(0, itemYPos, anchoScroll, itemHeight));
            GUI.Box(new Rect(0, 0, anchoScroll, itemHeight), "");
            GUI.Box(new Rect(0, 0, itemHeight, itemHeight), "");
//				GUIStyle bgImage = new GUIStyle ();
            style.normal.background = i.Image;
            GUI.Box(new Rect(1, 1, itemHeight - 2, itemHeight - 2), "", style);

            float quantityLabel = 0;
            //Dependiendo de la cantidad pintaremos la cantidad o no
            if (cantidades[i] > 1)
            {
                quantityLabel = 50;
                GUI.BeginGroup(new Rect(anchoScroll - quantityLabel, 0, quantityLabel, itemHeight));
                GUI.Box(new Rect(0, 0, quantityLabel, itemHeight), "");
                GUI.Label(new Rect(quantityLabel / 2f, itemHeight / 2f, quantityLabel, itemHeight), "" + cantidades[i]);
                GUI.EndGroup();
            }
            GUI.Label(new Rect(itemHeight, 0, anchoScroll - itemHeight - quantityLabel, itemHeight), i.Name + ": " + i.Description);
            itemYPos += itemHeight;
            GUI.EndGroup();
        }

        GUI.EndScrollView();
        if (GUI.Button(new Rect(0, altoGUI - 100, anchoGUI, 100), "Close"))
        {
            GUIManager.removeGUI(this);
            ScriptableObject.Destroy(this);
        }
        GUI.EndGroup();
    }
示例#58
0
 protected override void OnStop()
 {
     GUIManager.HideView("PlayerPanel");
 }
示例#59
0
 public override void CannotStart()
 {
     GUIManager.SetDisplayTextColor("I can't start for some reason!", 3, Color.red);         //Replace this line
 }
示例#60
0
 void Update()
 {
     GUIManager.Update();
 }