Exemple #1
0
    public void updateBuildingPlaceInfo()
    {
        bool isExploreFinished = false;

        isExploreFinished = Globals.Instance.MTaskManager.exploreFinished;
        PortsBuildingConfig cfg = Globals.Instance.MDataTableManager.GetConfig <PortsBuildingConfig>();

        PortBuildingElement element = null;
        int  portID  = Globals.Instance.MGameDataManager.MActorData.PortID;
        bool isExist = cfg.GetPortBuildingElement(portID, out element);

        if (!isExist)
        {
            return;
        }

        int             buildLogicID = Globals.Instance.MNpcManager.getCurrentInteractBuildingLogicID();
        BuildingElement bldElement   = element.GetBuildingElement(buildLogicID);

        if (null == bldElement)
        {
            if (Globals.Instance.MTaskManager.buildingExploreBG != "")
            {
                setBuildingBackgroudPic(Globals.Instance.MTaskManager.buildingExploreBG);
            }
            NGUITools.SetActive(mBuildExploreObj, false);
            return;
        }

        NGUITools.SetActive(mBuildExploreObj, true);

        if (Globals.Instance.MTaskManager.currentExplorePlaceID != 0)
        {
            string currentBuidlingName = Globals.Instance.MDataTableManager.GetWordText(bldElement._buildingNameID);
            if (!isExploreFinished)
            {
                ExploreBuildProgress.text = Globals.Instance.MTaskManager.exploreCount.ToString() + "/" +
                                            Globals.Instance.MTaskManager.exploreTotalCount.ToString();
                ExploreBuildName.text = currentBuidlingName + "-" + Globals.Instance.MTaskManager.currentTaskExploreName;

                ExploreBuildProgressBar.SetMaxValue((long)Globals.Instance.MTaskManager.exploreTotalCount);
                ExploreBuildProgressBar.SetValue((long)Globals.Instance.MTaskManager.exploreCount, (long)Globals.Instance.MTaskManager.exploreCount, 0.1f);
            }
            else
            {
                ExploreBuildProgressBar.SetMaxValue((long)1.0);
                ExploreBuildProgressBar.SetValue((long)1.0, (long)1.0, 0.1f);

                ExploreBuildName.text     = currentBuidlingName;
                ExploreBuildProgress.text = Globals.Instance.MDataTableManager.GetWordText(11014);
            }
        }


        if (Globals.Instance.MTaskManager.buildingExploreBG == "")
        {
            setBuildingBackgroudPic(bldElement._buildBG);
        }
        else
        {
            setBuildingBackgroudPic(Globals.Instance.MTaskManager.buildingExploreBG);
        }
    }
    private void InitPortBuildings()
    {
        MSeaAreaData = Globals.Instance.MGameDataManager.MCurrentSeaAreaData;
        PortData portData = MSeaAreaData.MPortData;

        foreach (BuildingData data in portData.BuildingDataList.Values)
        {
            _mHoldBuildingList.Add(data.LogicID, InstantiateBuilding(data));
        }

        // Play building change effect
        if (portData.BuildingChangeData.IsBuildingChange)
        {
            Building building = null;
            int      logicID  = portData.BuildingChangeData.CreateBuildingLogicID;
            if (-1 != logicID)
            {
                _mHoldBuildingList.TryGetValue(logicID, out building);
                if (null == building)
                {
                    return;
                }

                Vector3 worldPos = building.U3DGameObject.transform.position;
                MainCameraMoveTo(building.U3DGameObject, delegate()
                {
                    Globals.Instance.MEffectManager.CreateBuildingChangeEffect(worldPos, true, null);

                    string wordText = Globals.Instance.MDataTableManager.GetWordText(22000001);
                    wordText        = string.Format(wordText, 08, 22, building.Property.Name, portData.BasicData.PortName);
                    EZ3DItem ezItem = Globals.Instance.M3DItemManager.Create3DSimpleText(building.U3DGameObject, wordText, 0);
                    // destory item delay 2 second
                    Globals.Instance.M3DItemManager.DestroyEZ3DItem(ezItem.gameObject, 2.0f);
                });
            }

            logicID = portData.BuildingChangeData.DestroyBuildingLogicID;
            if (-1 != logicID)
            {
                PortsBuildingConfig cfg = Globals.Instance.MDataTableManager.GetConfig <PortsBuildingConfig>();

                PortBuildingElement element = null;
                bool isExist = cfg.GetPortBuildingElement(portData.PortID, out element);
                if (!isExist)
                {
                    return;
                }

                BuildingElement bldElement = element.GetBuildingElement(logicID);
                if (null == bldElement)
                {
                    return;
                }

                Vector3 worldPos = HelpUtil.GetSplitVector3(bldElement._buildingPostion);
                MainCameraMoveTo(worldPos + AimBuildingDeltaPos, AimBuildingDeltaEular, delegate()
                {
                    Globals.Instance.MEffectManager.CreateBuildingChangeEffect(worldPos, false, null);

                    string buildName = Globals.Instance.MDataTableManager.GetWordText(bldElement._buildingNameID);
                    string wordText  = Globals.Instance.MDataTableManager.GetWordText(22000002);
                    wordText         = string.Format(wordText, 08, 22, buildName, portData.BasicData.PortName);
                    EZ3DItem ezItem  = Globals.Instance.M3DItemManager.Create3DSimpleText(worldPos, wordText, 0);

                    Globals.Instance.M3DItemManager.DestroyEZ3DItem(ezItem.gameObject, 2.0f);
                    // tzz f****d
                    // who create who destory,stuip f**k!
                    //GameObject.Destroy(ezItem.gameObject, 2.0f);
                }
                                 );
            }
        }
        if (Globals.Instance.MNpcManager.mbDatingMapPlay)
        {
            Globals.Instance.MNpcManager.mbDatingMapPlay = false;
            Globals.Instance.MNpcManager.MapMoveAnimation();
        }
    }