Example #1
0
    void Awake()
    {
        gameObject.SetActiveRecursively(true);

        registerHandler();
        registerWidgets();
        petWidgetsShow();
        //动态加载,初始化
        mCurrentEquipIndex = 0;
        OnChangedRoleType(mCurrentRoleType);
        OnChangedOperator(mCurrentOperate);

        RegisterEnhanceHandle(OperateType.ENCHANCE);
        //查询自己宠物的装备信息
        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 (UIWindowMng.Instance.IsWindowShow("RoleTipWindow"))
        {
            GameObject  selfEquipt          = UIWindowMng.Instance.GetWindowGo("RoleTipWindow");
            UISelfEquip selfEquiptComponent = selfEquipt.GetComponent <UISelfEquip>();
            PET_EQUIP   activePart          = selfEquiptComponent.ActivePetEquiptPart;
            if (activePart != PET_EQUIP.PEQUIP_INVALID)
            {
                int           roleIndex = selfEquiptComponent.ActivePage;
                List <string> Params    = new List <string>();
                Params.Add(roleIndex.ToString());
                int temp = (int)(activePart);
                Params.Add(temp.ToString());
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_TOGGLE_PETEQUIPLEVELUP, Params);
            }
        }
    }
Example #2
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);
        }
    }