示例#1
0
    void InitVoxelPage()
    {
        if (!_initVoxelPage)
        {
            UISkillWndCtrl uiSkill = GameUI.Instance.mSkillWndCtrl;
            if (uiSkill._SkillMgr != null)
            {
                if (!uiSkill._SkillMgr.CheckUnlockBuildBlockVoxel())
                {
                    return;
                }
            }

            m_VoxelProtoItems = BSVoxelMatMap.GetAllProtoItems();
            foreach (int id in m_VoxelProtoItems)
            {
                ItemProto proto = ItemProto.Mgr.Instance.Get(id);
                int       index = mWndCtrl.AddVoxelMatListItem(proto.icon[0], "Icon");
                mWndCtrl.mVoxelMatList[index].SetItemID(proto.id);
            }

            mWndCtrl.ToolTip            += OnItemToolTip;
            mWndCtrl.TextureItemOnClick += OnVoxelMatItemClick;
            mWndCtrl.VoxelTypeOnClick   += OnVoxelTypeClick;

            mWndCtrl.ResetVoxelPostion();
            _initVoxelPage = true;
        }
    }
示例#2
0
    void OnVoxelMatItemClick(int index)
    {
        if (mWndCtrl.TextureListSelectIndex == -1 || mWndCtrl.TextureListSelectIndex >= m_VoxelProtoItems.Count)
        {
            return;
        }

        if (m_VoxelProtoItems == null)
        {
            InitVoxelPage();
        }

        if (m_VoxelProtoItems == null)
        {
            return;
        }

        m_VoxelTypeList = BSVoxelMatMap.GetMaterialIDs(m_VoxelProtoItems[mWndCtrl.TextureListSelectIndex]);

        List <string> icons = new List <string>();

        foreach (int type_id in m_VoxelTypeList)
        {
            BSVoxelMatMap.MapData data = BSVoxelMatMap.GetMapData(type_id);
            if (data != null)
            {
                icons.Add(data.icon);
            }
        }

        PEBuildingMan.Self.Pattern = BSPattern.DefaultV1;

        mWndCtrl.RefreshTypeLisItem(icons.ToArray(), "Icon");

        for (int i = 0; i < mWndCtrl.mTypeList.Count; i++)
        {
            mWndCtrl.mTypeList[i].SetItemID(m_VoxelTypeList[i]);
        }

        if (mWndCtrl.TypeSelectIndex > -1)
        {
            if (mWndCtrl.TypeSelectIndex >= mWndCtrl.mTypeList.Count)
            {
                mWndCtrl.TypeSelectIndex = 0;
            }

            PEBuildingMan.Self.Manipulator.MaterialType = (byte)mWndCtrl.mTypeList[mWndCtrl.TypeSelectIndex].ItemId;
        }
        else
        {
            mWndCtrl.TypeSelectIndex = 0;
            OnVoxelTypeClick(mWndCtrl.TypeSelectIndex);
        }

        mWndCtrl.DisselectBlock();

        ChangeBrushToBox();
    }
示例#3
0
 void OnItemToolTip(bool show, UIBuildWndItem.ItemType item_type, int item_index)
 {
     if (item_type == UIBuildWndItem.ItemType.mVoxelMat)
     {
         ItemProto proto = ItemProto.Mgr.Instance.Get(m_VoxelProtoItems[item_index]);
         UITooltip.ShowText(proto.GetName());
     }
     else if (item_type == UIBuildWndItem.ItemType.mBlockMat)
     {
         ItemProto proto = ItemProto.Mgr.Instance.Get(m_BlockProtoItems[item_index]);
         UITooltip.ShowText(proto.GetName());
     }
     else if (item_type == UIBuildWndItem.ItemType.mMenu)
     {
         UIBuildWndItem item = mMenuCtrl.mBoxBars.Items[item_index].GetComponent <UIBuildWndItem>();
         if (item != null)
         {
             if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelMat)
             {
                 ItemProto proto = ItemProto.Mgr.Instance.Get(m_VoxelProtoItems[item.mTargetIndex]);
                 UITooltip.ShowText(proto.GetName());
             }
             else if (item.mTargetItemType == UIBuildWndItem.ItemType.mBlockMat)
             {
                 ItemProto proto = ItemProto.Mgr.Instance.Get(m_BlockProtoItems[item.mTargetIndex]);
                 UITooltip.ShowText(proto.GetName());
             }
             else if (item.mTargetItemType == UIBuildWndItem.ItemType.mVoxelType)
             {
                 int       proto_id = BSVoxelMatMap.GetItemID(item.ItemId);
                 ItemProto proto    = ItemProto.Mgr.Instance.Get(proto_id);
                 UITooltip.ShowText(proto.GetName());
             }
         }
     }
     else if (item_type == UIBuildWndItem.ItemType.mVoxelType)
     {
         int       proto_id = BSVoxelMatMap.GetItemID(m_VoxelTypeList[item_index]);
         ItemProto proto    = ItemProto.Mgr.Instance.Get(proto_id);
         UITooltip.ShowText(proto.GetName());
     }
 }
示例#4
0
 public static int GetVoxelItemProtoID(byte matIndex)
 {
     return(BSVoxelMatMap.GetItemID(matIndex));
 }
示例#5
0
    void OnMenuQuickBarClick(UIBuildWndItem item)
    {
        if (item.mTargetItemType != UIBuildWndItem.ItemType.mNull &&
            item.mTargetItemType != UIBuildWndItem.ItemType.mMenu &&
            !item.IsActive)
        {
            //lz-2016.10.31 Insufficient skill to use this item.
            new PeTipMsg(PELocalization.GetString(8000854), PeTipMsg.EMsgLevel.Warning, PeTipMsg.EMsgType.Misc);
            return;
        }


        switch (item.mTargetItemType)
        {
        case UIBuildWndItem.ItemType.mVoxelType:
        {
            if (PEBuildingMan.Self != null)
            {
                if (!GameUI.Instance.mSkillWndCtrl._SkillMgr.CheckUnlockBuildBlockVoxel())
                {
                    return;
                }
                PEBuildingMan.Self.Manipulator.MaterialType = (byte)item.ItemId;
                PEBuildingMan.Self.Pattern = BSPattern.DefaultV1;

                mWndCtrl.DisselectBlock();
                // Refresh the selected voxel mat for control window
                int itemID = BSVoxelMatMap.GetItemID(item.ItemId);
                for (int i = 0; i < mWndCtrl.mVoxelMatList.Count; i++)
                {
                    if (mWndCtrl.mVoxelMatList[i].ItemId == itemID)
                    {
                        mWndCtrl.TextureListSelectIndex = i;

                        OnVoxelMatItemClick(i);

                        mWndCtrl.TypeSelectIndex = item.mTargetIndex;
                        break;
                    }
                }

                ChangeBrushToBox();
            }
        } break;

        case UIBuildWndItem.ItemType.mBlockMat:
        {
            if (PEBuildingMan.Self != null)
            {
                PEBuildingMan.Self.Manipulator.MaterialType = (byte)PEBuildingMan.GetBlockMaterialType(item.ItemId);

                if (PEBuildingMan.Self.Pattern == null || PEBuildingMan.Self.Pattern.type == EBSVoxelType.Voxel)
                {
                    if (mWndCtrl.BlockPatternSelectIndex == -1)
                    {
                        PEBuildingMan.Self.Pattern = BSPattern.DefaultB1;
                    }
                    else
                    {
                        if (mWndCtrl.mBlockPatternList.Count > mWndCtrl.BlockPatternSelectIndex && mWndCtrl.TextureListSelectIndex > -1)
                        {
                            PEBuildingMan.Self.Pattern = BSPattern.s_tblPatterns[mWndCtrl.mBlockPatternList[mWndCtrl.BlockPatternSelectIndex].ItemId];
                        }
                    }
                }

                mWndCtrl.DisselectVoxel();

                // Refresh the selected block mat for control window
                for (int i = 0; i < mWndCtrl.mBlockMatList.Count; i++)
                {
                    if (mWndCtrl.mBlockMatList[i].ItemId == item.ItemId)
                    {
                        mWndCtrl.BlockMatSelectIndex = i;
                        OnBlockMatClick(i);
                        break;
                    }
                }

                ChangeBrushToBox();
            }
        } break;

        case UIBuildWndItem.ItemType.mBlockPattern:
        {
            if (PEBuildingMan.Self != null)
            {
                if (PEBuildingMan.Self.Pattern == null)
                {
                    OnBlockMatClick(0);
                }
                else if (PEBuildingMan.Self.Pattern.type == EBSVoxelType.Voxel)
                {
                    if (mWndCtrl.mVoxelMatList.Count > mWndCtrl.TextureListSelectIndex && mWndCtrl.TextureListSelectIndex > -1)
                    {
                        PEBuildingMan.Self.Manipulator.MaterialType = (byte)PEBuildingMan.GetBlockMaterialType(mWndCtrl.mVoxelMatList[mWndCtrl.TextureListSelectIndex].ItemId);
                    }
                }

                mWndCtrl.DisselectVoxel();

                int i = 0;
                foreach (var kvp in BSPattern.s_tblPatterns)
                {
                    if (i == item.mTargetIndex)
                    {
                        if (mWndCtrl.TextureListSelectIndex != -1)
                        {
                            int itemId = mWndCtrl.mVoxelMatList[mWndCtrl.TextureListSelectIndex].ItemId;
                            PEBuildingMan.Self.Manipulator.MaterialType = (byte)PEBuildingMan.GetBlockMaterialType(itemId);
                            int find_index = mWndCtrl.mBlockMatList.FindIndex(item0 => item0.ItemId == itemId);
                            if (find_index != -1)
                            {
                                mWndCtrl.BlockMatSelectIndex = find_index;
                            }
                            else
                            {
                                mWndCtrl.BlockMatSelectIndex = 0;
                            }
                        }
                        else if (mWndCtrl.BlockMatSelectIndex == -1)
                        {
                            PEBuildingMan.Self.Manipulator.MaterialType = (byte)PEBuildingMan.GetBlockMaterialType(mWndCtrl.mBlockMatList[0].ItemId);
                            mWndCtrl.BlockMatSelectIndex = 0;
                        }

                        PEBuildingMan.Self.Pattern = kvp.Value;

                        break;
                    }
                    i++;
                }

                if (item.mTargetIndex != -1)
                {
                    mWndCtrl.BlockPatternSelectIndex = item.mTargetIndex;
                }

                ChangeBrushToBox();
            }
        } break;

        default:
            break;
        }
    }
示例#6
0
    public static void LoadAllData()
    {
        if (s_localDatabase != null)
        {
            return;
        }

#if UNITY_EDITOR
        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
        sw.Start();
#endif
        s_localDatabase = LoadDb();
        SkillSystem.SkData.LoadData();
        Pathea.Effect.EffectData.LoadData();
        Pathea.Projectile.ProjectileData.LoadData();
        Pathea.RequestRelation.LoadData();
        Pathea.CampData.LoadData();
        Pathea.ThreatData.LoadData();
        Pathea.DamageData.LoadData();
        HumanSoundData.LoadData();
        ItemDropData.LoadData();

        PELocalization.LoadData();

        NaturalResAsset.NaturalRes.LoadData();
        //SkillAsset.EffCastData.LoadData();
        //SkillAsset.EffSkill.LoadData();
        //SkillAsset.MergeSkill.LoadData();
        //AnimData.LoadData();
        //AnimSoundData.LoadData();

        AiAsset.AiData.LoadData();

        SoundAsset.SESoundBuff.LoadData();
        SoundAsset.SESoundStory.LoadData();
        //CharacterData.LoadCharacterData();
        StoryDoodadMap.LoadData();
        StoreRepository.LoadData();
        NpcMissionDataRepository.LoadData();
        //PlayerAttribute.LoadData();
        MissionRepository.LoadData();
        TalkRespository.LoadData();
        //NpcRandomRepository.LoadData();
        ShopRespository.LoadData();
        WareHouseManager.LoadData();
        //HeroTalkRepository.LoadData();
        MutiPlayRandRespository.LoadData();
        PromptRepository.LoadData();

        //MapIconData.LoadDate();
        //MapMaskData.LoadDate();
        CampPatrolData.LoadDate();
        Camp.LoadData();
        RepProcessor.LoadData();

        CloudManager.LoadData();
        //BattleUnitData.LoadData();
        TutorialData.LoadData();
        //RepairMachineManager.LoadData();
        MapMaskData.LoadDate();
        MessageData.LoadData();         //lz-2016.07.13 Add it
        MonsterHandbookData.LoadData(); //lz-2016.07.20 Add it
        StoryRepository.LoadData();
        RMRepository.LoadRandMission();
        MisInitRepository.LoadData();
        CameraRepository.LoadCameraPlot();
        AdRMRepository.LoadData();
        VCConfig.InitConfig();
        Cutscene.LoadData();

//		BuildBrushData.LoadBrush();
        BSPattern.LoadBrush();
        BSVoxelMatMap.Load();
        BSBlockMatMap.Load();
        BlockBuilding.LoadBuilding();
        LifeFormRule.LoadData();
        PlantInfo.LoadData();
        MetalScanData.LoadData();
        BattleConstData.LoadData();
        CustomCharactor.CustomMetaData.LoadData();
        SkillTreeInfo.LoadData();
        VArtifactUtil.LoadData();
        Pathea.ActionRelationData.LoadActionRelation();

        //colony
        CSInfoMgr.LoadData();
        ProcessingObjInfo.LoadData();
        CSTradeInfoData.LoadData();
        CampTradeIdData.LoadData();
        AbnormalTypeTreatData.LoadData();
        CSMedicineSupport.LoadData();
        //RandomItemMgr
        RandomItemDataMgr.LoadData();
        FecesData.LoadData();
        //randomdungeon
        RandomDungeonDataBase.LoadData();
        AbnormalData.LoadData();
        PEAbnormalNoticeData.LoadData();

        RelationInfo.LoadData();
        EquipSetData.LoadData();
        SuitSetData.LoadData();

        CheatData.LoadData();

        Pathea.NpcProtoDb.Load();
        Pathea.MonsterProtoDb.Load();
        Pathea.MonsterRandomDb.Load();
        Pathea.MonsterGroupProtoDb.Load();
        Pathea.RandomNpcDb.Load();
        Pathea.PlayerProtoDb.Load();
        Pathea.TowerProtoDb.Load();
        Pathea.DoodadProtoDb.Load();
        Pathea.AttPlusNPCData.Load();
        Pathea.AttPlusBuffDb.Load();
        Pathea.NpcTypeDb.Load();
        Pathea.NpcRandomTalkDb.Load();
        Pathea.NpcThinkDb.LoadData();
        Pathea.NpcEatDb.LoadData();
        Pathea.NpcRobotDb.Load();
        Pathea.NPCScheduleData.Load();
        Pathea.NpcVoiceDb.LoadData();
        InGameAidData.LoadData(); //lz-2016.08.21 add it
        MountsSkillDb.LoadData();

#if UNITY_EDITOR
        sw.Stop();
        Debug.Log("Database Loaded : " + sw.ElapsedMilliseconds);
        sw.Reset();
#else
        Debug.Log("Database Loaded");
#endif
    }