Esempio n. 1
0
    public void OnEvent(GAME_EVENT_ID eventId, List <string> vParam)
    {
        int count = OpenFuncSystem.Instance.funcList.Count;

        if (eventId == GAME_EVENT_ID.GE_ADD_MISSION)
        {
            int id = int.Parse(vParam[0]);
            if (id != -1)
            {
                for (int i = 0; i < count; i++)
                {
                    if (id == OpenFuncSystem.Instance.funcList[i].receiveMission)
                    {
                        list = OpenFuncSystem.Instance.funcList[i];
                        gameObject.SetActiveRecursively(true);
                        Texture2D icon = IconManager.Instance.GetIcon(list.desc);
                        tubiaoicon.SetTexture(icon);
                        tubiaoicon.width  = icon.width;
                        tubiaoicon.height = icon.height;
                    }
                }
            }
        }
        else if (eventId == GAME_EVENT_ID.GE_UNIT_LEVEL)
        {
            int nLevel = int.Parse(PlayerMySelf.Instance.GetData("LEVEL"));
            if (nLevel != -1)
            {
                for (int j = 0; j < count; j++)
                {
                    if (nLevel == OpenFuncSystem.Instance.funcList[j].needLevel)
                    {
                        list = OpenFuncSystem.Instance.funcList[j];
                        gameObject.SetActiveRecursively(true);
                        Texture2D icon = IconManager.Instance.GetIcon(list.desc);
                        tubiaoicon.SetTexture(icon);
                        tubiaoicon.width  = icon.width;
                        tubiaoicon.height = icon.height;
                    }
                }
            }
        }
    }
Esempio n. 2
0
    public void UpdateFuncEnable()
    {
        if (funcList.Count == 0)
        {
            UnRegistConditions();
            return;
        }

        CObject_PlayerMySelf mySelf = CObjectManager.Instance.getPlayerMySelf();
        CDetailAttrib_Player myData = CDetailAttrib_Player.Instance;

        if (mySelf == null || myData == null)
        {
            return;
        }
        //////////////////////////////////////////////////////////////////////////
        // 由于界面表现要有特殊标示,所以特殊对待
        int x1Pos = 0;
        int y2Pos = 45;
        int index = -1;

        //////////////////////////////////////////////////////////////////////////
        foreach (_DBC_FUNC_OPEN_LIST enumerator in funcList)
        {
            index++;
            bool showEnable          = true;
            _DBC_FUNC_OPEN_LIST func = enumerator;
            if (func.needLevel != MacroDefine.INVALID_ID && mySelf.GetCharacterData().Get_Level() < func.needLevel)
            {
                showEnable = false;
            }
            else if (func.receiveMission != MacroDefine.INVALID_ID)
            {
                if ((myData.GetMissionIndexByID(func.receiveMission) == MacroDefine.INVALID_ID) &&
                    !myData.IsMissionHaveDone((uint)func.receiveMission))
                {
                    showEnable = false;
                }
            }
            else if (func.finishMission != MacroDefine.INVALID_ID)
            {
                if (!myData.IsMissionHaveDone((uint)func.finishMission))
                {
                    showEnable = false;
                }
            }

            if (uiGoList[index] == null)
            {
                uiGoList[index] = GameObject.Find(enumerator.uiName);
            }

            if (uiGoList[index] != null)
            {
                if (showEnable)
                {
                    if (uiGoList[index].layer != LayerManager.UILayer)
                    {
                        uiGoList[index].layer = LayerManager.UILayer;
                    }

                    //////////////////////////////////////////////////////////////////////////
                    Vector3 pos = uiGoList[index].transform.localPosition;
                    switch (enumerator.specialTag)
                    {
                    case 1:
                        pos.x  = x1Pos;
                        x1Pos -= 45;
                        break;

                    case 2:
                        pos.y  = y2Pos;
                        y2Pos += 45;
                        break;

                    default:
                        break;
                    }
                    uiGoList[index].transform.localPosition = pos;
                    //////////////////////////////////////////////////////////////////////////

                    //                 funcList.Remove(enumerator.Current.Key);
                    //                 enumerator = funcList.GetEnumerator();
                }
                else
                {
                    if (uiGoList[index].layer == LayerManager.UILayer)
                    {
                        uiGoList[index].layer = LayerManager.DefaultLayer;
                    }
                }
            }
        }
    }