private bool AddOption(ref Vector3 pos, OptionConfig op)
    {
        //控制选项上部空5个像素 [3/23/2012 Ivan]
        pos.x = 30;
        //pos.y = 10;

        GameObject option = Instantiate(OptionPrefab) as GameObject;

        option.name = op.WinName;
        option.transform.position = pos;
        //GFX.GfxUtility.attachGameObject(option, childGo);
        GFX.GfxUtility.attachGameObject(option, childOptGo);
        option.layer = LayerManager.UILayer;

        UIButton button = option.GetComponent <UIButton>();

        button.Anchor                 = SpriteRoot.ANCHOR_METHOD.UPPER_LEFT;
        button.spriteText.Anchor      = SpriteText.Anchor_Pos.Upper_Left;
        button.spriteText.lineSpacing = 1;
        button.Text = op.Content;

        float buttonHeight = (button.spriteText.renderer.bounds.max.y - button.spriteText.renderer.bounds.min.y);

        pos.y -= buttonHeight;

        button.AddInputDelegate(OptionClick);

        return(true);
    }
Beispiel #2
0
 public void Show(DialogDescriptor message, Action onClosed)
 {
     ResetThumbnails();
     ShowThumbnail(message);
     OnAccepted = onClosed;
     closeButton.AddInputDelegate(Close);
     base.Show(message);
 }
    public override void Initial()
    {
        UIButton render = gameObject.GetComponent <UIButton>();

        if (render != null)
        {
            render.AddInputDelegate(InputDelegate);
        }
    }
Beispiel #4
0
    IUIListObject NewChild(string name, string goName)
    {
        IUIListObject newItem = list.CreateItem(childPrefab, name);

        newItem.gameObject.name = goName;
        UIButton btn = newItem.gameObject.GetComponent <UIButton>();

        if (btn != null)
        {
            btn.AddInputDelegate(ItemsInputDelegate);
        }
        return(newItem);
    }
    UIButton NextFreeWin(int id, out bool alreadyExist)
    {
        alreadyExist = false;

        UIButton freeWin = null;

        if (unUsedWindows.Count != 0)
        {
            foreach (UIButton btn in unUsedWindows)
            {
                if (btn.name == "mapIcon" + id)
                {
                    freeWin = btn;
                    unUsedWindows.Remove(freeWin);
                    alreadyExist = true;
                    break;
                }
            }
            if (freeWin == null && unUsedWindows.Count >= maxPoolNum)
            {
                freeWin      = unUsedWindows[0];
                freeWin.data = null;
                freeWin.name = "mapIcon" + id;
                unUsedWindows.RemoveAt(0);
            }
        }

        if (freeWin == null)
        {
            GameObject win = UnityEngine.Object.Instantiate(iconPrefab,
                                                            Vector3.zero, new Quaternion(0, 0, 0, 0)) as GameObject;
            win.SetActiveRecursively(false);

            win.name             = "mapIcon" + id;
            win.layer            = LayerManager.UILayer;
            win.transform.parent = gameObject.transform;

            freeWin = win.GetComponent <UIButton>();
            freeWin.AddInputDelegate(ItemDragDelegate);
        }

        usedWindows.Add(freeWin);
        freeWin.gameObject.SetActiveRecursively(false);
        return(freeWin);
    }
    void Start()
    {
//		GetComponent<GUIEnabler>().onEnableGUI = (enabled) => _inputEnabled = enabled;
        LevelManager.instance.GameStateChangedEvent += () =>
        {
            _inputEnabled = (LevelManager.instance.gameState == LevelManager.State.Construction);
        };

        GridManager.instance.OnGridChangedEvent += () =>
        {
            grabberButton.gameObject.SetActive(LevelEditorGUI.hasActiveInstance || !GridManager.instance.IsLevelOptionActive(LevelOption.DisableGrabberPlacement));
            welderButton.gameObject.SetActive(LevelEditorGUI.hasActiveInstance || !GridManager.instance.IsLevelOptionActive(LevelOption.DisableWelderPlacement));
        };

        grabberButton.AddInputDelegate(GrabberInputDelegate);
        welderButton.AddInputDelegate(WelderInputDelegate);
        generatorButton.AddInputDelegate(GeneratorInputDelegate);
    }
Beispiel #7
0
    void Awake()
    {
        GameObject parent = UISystem.Instance.UiCamrea.gameObject;

        gameObject.transform.position = parent.transform.position + new Vector3(0, 0, 10);
        //gameObject.transform.parent = parent.transform;
        if (turnLeft == null)
        {
            turnLeft = GameObject.Find("TurnLeft").GetComponent <UIButton>();
        }
        turnLeft.AddInputDelegate(RoteRole);
        if (turnRight == null)
        {
            turnRight = GameObject.Find("TurnRight").GetComponent <UIButton>();
        }
        turnRight.AddInputDelegate(RoteRole);

        gameObject.SetActiveRecursively(false);

        CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UI_INFOS, "LoginMapDownload");

        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_GAMELOGIN_OPEN_CREATE_CHARACTOR, OnCreateRole);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_GAMELOGIN_REFRESH_ROLE_SELECT_CHARACTOR, OnCreateRole);
    }
Beispiel #8
0
    void Awake()
    {
        gameObject.SetActiveRecursively(true);
        peiyangWinGo.SetActiveRecursively(false);
        //nameBtn = NameButton.GetComponent<SpriteText>();
        //expButton = ExpButton.GetComponent<UIProgressBar>();

        //gameObject.transform.root.gameObject.SetActiveRecursively(true);

        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_ROLE_TIPWINDOW, RefreshEquip);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_NAME, Equip_OnUpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_EXP, Equip_OnUpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UPDATE_EQUIP, RefreshEquip);

        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HP, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_MP, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_STR, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_SPR, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_CON, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_INT, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_DEX, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_BRING_STR, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_BRING_SPR, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_BRING_CON, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_BRING_INT, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_BRING_DEX, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_ATT_PHYSICS, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_ATT_MAGIC, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_DEF_PHYSICS, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_DEF_MAGIC, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_HIT, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_MISS, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_CRIT_RATE, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_DEF_CRIT_RATE, Equip_UpdateShow);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UPDATE_PRESCR, Equip_UpdatePrescr);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_PACKAGE_ITEM_CHANGED, UpdateEquiptLevelUpButton);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UPDATE_PETEQUIP, UpdatePetEquipt);


        for (int i = 0; i < mRoleMenus.Count; i++)
        {
            mRoleMenus[i].SetValueChangedDelegate(RoleMenuValueChanged);
            if (mRoleMenus[i].defaultValue)
            {
                mCurrentRoleType = (RoleType)i;
            }
        }

        petTurnLeft_.AddInputDelegate(OnMouseEvent);
        petTurnRight_.AddInputDelegate(OnMouseEvent);
        turnLeft_.AddInputDelegate(OnMouseEvent);
        turnRight_.AddInputDelegate(OnMouseEvent);

        petHeadLevelUp_.AddInputDelegate(OnMouseLevelUpEquipt);
        petSpurLevelUp_.AddInputDelegate(OnMouseLevelUpEquipt);
        petClawLevelUp_.AddInputDelegate(OnMouseLevelUpEquipt);
        petRingLevelUp_.AddInputDelegate(OnMouseLevelUpEquipt);
        petBodyLevelUp_.AddInputDelegate(OnMouseLevelUpEquipt);
        petTattooLevelUp_.AddInputDelegate(OnMouseLevelUpEquipt);



        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_TOGLE_PET_PAGE, OnPetEvent);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UPDATE_PET_PAGE, OnPetEvent);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_ACCELERATE_KEYSEND, OnPetEvent);
        CEventSystem.Instance.RegisterEventHandle(GAME_EVENT_ID.GE_UNIT_LEVEL, OnPetEvent);

        RefreshRolePageCaption();
        //Equip_RefreshEquip();
        //PlayerInfo_Update();
        //Tip_Refresh();
        OnChangedRoleType(RoleType.ROLE_SELF);

        //查询自己宠物的装备信息
        for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
        {
            SDATA_PET curPet = CDataPool.Instance.Pet_GetPet(i);
            if (!curPet.GUID.IsNull())
            {
                CGAskDetailPetEquipList queryPet = new CGAskDetailPetEquipList();
                queryPet.GUID       = curPet.GUID;
                queryPet.EquiptType = ASK_PET_EQUIP_TYPE.ASK_PET_EQUIP_MYSELF;
                queryPet.ObjID      = -1;//(int)curPet.idServer;
                NetManager.GetNetManager().SendPacket(queryPet);
            }
        }

        if (gameObject.active)
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_ROLE_TIPWINDOWSHOWN);
        }
    }
Beispiel #9
0
 private void Start()
 {
     myTransform = transform;
     buttonSetDice.AddInputDelegate(StopDice);
 }
 void Start()
 {
     SetDebugText();
     button.AddInputDelegate(GrabberInputDelegate);
 }
 // Use this for initialization
 void Start()
 {
     transform.localPosition = new Vector3(0, 0, moveZto);
     _catcher.AddInputDelegate(InputDelegate);
 }
Beispiel #12
0
 private void AddButtonsDelegates()
 {
     acceptButton.AddInputDelegate(Close);
     cancelButton.AddInputDelegate(Cancel);
 }