Ejemplo n.º 1
0
    void OnMetalSelected(object sender)
    {
        MetalScanItem_N item = sender as MetalScanItem_N;

        if (item == null)
        {
            return;
        }
        byte          voxelType = item.mType;
        MetalScanItem msi       = MetalScanData.GetItemByVoxelType(voxelType);

        if (null != msi)
        {
            mMetalSpr.spriteName = msi.mTexName;
            mMetalSpr.MakePixelPerfect();
            mMetalDes.text = PELocalization.GetString(msi.mDesID);
        }

        for (int i = 0; i < mMetalScanItemList.Count; ++i)
        {
            if (mMetalScanItemList[i] == item)
            {
                MetalScanData.m_ScanState[i] = item.mCheckBox.isChecked;
                break;
            }
        }
//		MetalScanData.m_ScanState[i] = true;
    }
Ejemplo n.º 2
0
        public void Restore()
        {
            byte[] data = ArchiveMgr.Instance.GetData(TutorialDataArchiveKey);

            if (null != data)
            {
                TutorialData.Deserialize(data);
            }

            data = ArchiveMgr.Instance.GetData(MetalScanDataArchiveKey);

            if (null != data)
            {
                MetalScanData.Deserialize(data);
            }

            data = ArchiveMgr.Instance.GetData(MessageDataArchveKey);

            if (null != data)
            {
                MessageData.Deserialize(data);
            }

            data = ArchiveMgr.Instance.GetData(MonsterHandbookDataArchveKey);

            if (null != data)
            {
                MonsterHandbookData.Deserialize(data);
            }
        }
Ejemplo n.º 3
0
        bool LearnMetalScan(ItemAsset.MetalScan metalScan, bool bLearn = true)
        {
            if (null == metalScan)
            {
                return(false);
            }

            if (Entity.Id != PeCreature.Instance.mainPlayerId)
            {
                return(false);
            }

            foreach (int metalId in metalScan.metalIds)
            {
                if (!MetalScanData.HasMetal(metalId))
                {
                    if (bLearn)
                    {
                        MetalScanData.AddMetalScan(metalScan.metalIds);
                    }
                    LearnEffectAndSound();
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
 public void New()
 {
     MetalScanData.Clear();
     //lz-2016.07.25 添加清空方法,在新游戏的时候清空保存的用户数据
     MessageData.Clear();
     TutorialData.Clear();
     MonsterHandbookData.Clear();
 }
Ejemplo n.º 5
0
    void RPC_S2C_MetalScanList(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int[] metalScan = stream.Read <int[]>();
        bool  openWnd   = stream.Read <bool>();

        MetalScanData.AddMetalScan(metalScan, openWnd);

        //if (null != PlayerFactory.mMainPlayer)
        //    PlayerFactory.mMainPlayer.ApplyMetalScan(metalScan.ToList());
    }
Ejemplo n.º 6
0
 public bool RefreshBuff(SkAliveEntity ske)
 {
     if (ske == null)
     {
         return(false);
     }
     foreach (List <string> iter in cmd)
     {
         if (iter != null)
         {
             if (iter.Count > 1)
             {
                 if (iter[0] == "buff")
                 {//"buff",buffid,atrtype,atrvalue,atrtype1,atrvalue1....
                     int          buffid   = Convert.ToInt32(iter[1]);
                     List <int>   atrtype  = new List <int>();
                     List <float> atrvalue = new List <float>();
                     for (int i = 2; i < iter.Count; i = i + 2)
                     {
                         atrtype.Add(Convert.ToInt32(iter[i]));
                         atrvalue.Add(Convert.ToSingle(iter[i + 1]));
                     }
                     if (atrtype.Count > 0 && atrvalue.Count > 0)
                     {
                         //remove old buff
                         SkEntity.UnmountBuff(ske, buffid);
                         //add buff
                         SkEntity.MountBuff(ske, buffid, atrtype, atrvalue);
                     }
                 }
                 else if (iter[0] == "scanradius")
                 {//"scanradius",Radius
                     int radius = Convert.ToInt32(iter[1]);
                     MSScan.Instance.radius = radius;
                 }
                 else if (iter[0] == "scanmat")
                 {//"scanmat",mat1,mat2...
                     for (int i = 1; i < iter.Count; i++)
                     {
                         MetalScanData.AddMetalScan(Convert.ToInt32(iter[i]));
                     }
                 }
             }
         }
     }
     return(true);
 }
Ejemplo n.º 7
0
    void ResetMetal()
    {
        if (GameUI.Instance != null && GameUI.Instance.mMainPlayer != null)
        {
//            foreach (MetalScanItem_N item in mMetalScanItemList)
//            {
//                item.transform.parent = null;
//                GameObject.Destroy(item.gameObject);
//            }
//            mMetalScanItemList.Clear();

            if (mMetalScanItemList.Count < MetalScanData.m_ActiveIDList.Count)
            {
                for (int i = MetalScanData.m_ActiveIDList.Count - mMetalScanItemList.Count; i >= 0; --i)
                {
                    MetalScanItem_N item = Instantiate(mMetalScanItemPerfab) as MetalScanItem_N;
                    item.transform.parent        = mMetalScanGrid.transform;
                    item.transform.localPosition = Vector3.back;
                    item.transform.localScale    = Vector3.one;
                    item.e_OnClick          += OnMetalSelected;
                    item.mCheckBox.isChecked = true;
                    mMetalScanItemList.Add(item);
                }
            }

            for (int i = 0; i < mMetalScanItemList.Count; i++)
            {
                if (i < MetalScanData.m_ActiveIDList.Count)
                {
                    MetalScanItem msi = MetalScanData.GetItemByID(MetalScanData.m_ActiveIDList[i]);
                    if (msi == null)
                    {
                        continue;
                    }
                    mMetalScanItemList[i].gameObject.SetActive(true);
                    mMetalScanItemList[i].SetItem(msi.mMatName, msi.mColor, msi.mType, msi.mDesID);
                    mMetalScanItemList[i].mCheckBox.isChecked = MetalScanData.m_ScanState[i];
                }
                else
                {
                    mMetalScanItemList[i].gameObject.SetActive(false);
                }
            }
            mMetalScanGrid.repositionNow = true;
        }
    }
Ejemplo n.º 8
0
 void ISerializable.Serialize(PeRecordWriter w)
 {
     if (w.key == TutorialDataArchiveKey)
     {
         w.binaryWriter.Write(TutorialData.Serialize());
     }
     else if (w.key == MetalScanDataArchiveKey)
     {
         w.binaryWriter.Write(MetalScanData.Serialize());
     }
     else if (w.key == MessageDataArchveKey)
     {
         w.binaryWriter.Write(MessageData.Serialize());
     }
     else if (w.key == MonsterHandbookDataArchveKey)
     {
         w.binaryWriter.Write(MonsterHandbookData.Serialize());
     }
 }
Ejemplo n.º 9
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
    }
Ejemplo n.º 10
0
    void ScanOneChunk(IntVector4 cposlod, out List <Vector3> outputVerts, out List <Color32> outputCols)
    {
        outputVerts = new List <Vector3>();
        outputCols  = new List <Color32>();
        VFVoxelChunkData cdata = _dataSource.readChunk(cposlod.x, cposlod.y, cposlod.z, cposlod.w);

        if (cdata == null)
        {
            return;
        }
        byte[] data = cdata.DataVT;
        int    nLen = data.Length;

        if (nLen == 0)
        {
            return;
        }
        if (nLen == VFVoxel.c_VTSize)
        {
            if (mMatList.Contains(data[1]))
            {
                int nVerts = 1 << (VoxelTerrainConstants._shift * 3);
                outputVerts = new List <Vector3>(nVerts);
                outputCols  = new List <Color32>(nVerts);
                Vector3 point = new Vector3(0, 0, 0);
                Color32 col   = MetalScanData.GetColorByType((byte)(data[0] * 2));            // new Color32((byte)(data[0]*2), 0, 0, 255);
                for (int z = 0; z < VoxelTerrainConstants._numVoxelsPerAxis; z++, point.z++)
                {
                    for (int y = 0; y < VoxelTerrainConstants._numVoxelsPerAxis; y++, point.y++)
                    {
                        for (int x = 0; x < VoxelTerrainConstants._numVoxelsPerAxis; x++, point.x++)
                        {
                            outputVerts.Add(point);
                            outputCols.Add(col);
                        }
                        point.x = 0;
                    }
                    point.y = 0;
                }
                return;
            }
            return;
        }
        else
        {
            int idx = (VoxelTerrainConstants._numVoxelsPrefix * VoxelTerrainConstants.VOXEL_ARRAY_AXIS_SIZE + VoxelTerrainConstants._numVoxelsPrefix)
                      * VoxelTerrainConstants.VOXEL_ARRAY_AXIS_SIZE + VoxelTerrainConstants._numVoxelsPrefix;
            for (int z = 0; z < VoxelTerrainConstants._numVoxelsPerAxis; z++)
            {
                for (int y = 0; y < VoxelTerrainConstants._numVoxelsPerAxis; y++)
                {
                    for (int x = 0; x < VoxelTerrainConstants._numVoxelsPerAxis; x++, idx++)
                    {
                        int idxBy = idx << 1;
                        if (data[idxBy] >= 128)
                        {
                            byte  curType = data[idxBy + 1];
                            Color col     = MetalScanData.GetColorByType(curType);
                            if (mMatList.Contains(curType))
                            {
                                outputVerts.Add(new Vector3(x, y, z));
                                outputCols.Add(col);
                                //outputCols.Add(new Color32(255, 0, 0, 255));
                            }
                        }
                    }
                    idx += VoxelTerrainConstants._numVoxelsPrefix + VoxelTerrainConstants._numVoxelsPostfix;
                }
                idx += (VoxelTerrainConstants._numVoxelsPrefix + VoxelTerrainConstants._numVoxelsPostfix) * VoxelTerrainConstants.VOXEL_ARRAY_AXIS_SIZE;
            }
        }
        return;
    }