public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetInt(IDKey, out _ID); dict.TryGetInt(MagazineSizeKey, out _MagazineSize); dict.TryGetInt(ConsumePerHitKey, out _ConsumePerHit); dict.TryGetInt(DamageValKey, out _DamageVal); dict.TryGetFloat(AtkIntervalKey, out _AtkInterval); dict.TryGetFloat(ChargeTimeKey, out _ChargeTime); dict.TryGetFloat(ReloadTimeKey, out _ReloadTime); dict.TryGetFloat(ThrustKey, out _Thrust); dict.TryGetFloat(AlertRangeKey, out _AlertRange); dict.TryGetString(PrefabPathKey, out _PrefabPath); dict.TryGetString(SkinNameKey, out _SkinName); string customDataKey; dict.TryGetString(OpaTypeKey, out customDataKey); _OpaType = new GDEEnum_OpaTypeData(customDataKey); dict.TryGetString(AniTypeKey, out customDataKey); _AniType = new GDEEnum_WeaponAniTypeData(customDataKey); LoadFromSavedData(dataKey); } }
// // Initialize the GameObject from the values in the GDEDataManager // using the TryGet() methods. // public void Init() { if (Data != null) { // Pull out the position value from Game Data Vector3 startPosition; Data.TryGetVector3("position", out startPosition); transform.localPosition = startPosition; // Pull out the minScale value from Game Data Data.TryGetVector3("minScale", out minScale); transform.localScale = minScale; // Pull out the maxScale value from Game Data Data.TryGetVector3("maxScale", out maxScale); targetScale = maxScale; // Pull out the scaleSpeed value from Game Data Data.TryGetFloat("scaleSpeed", out scaleSpeed); // Pull out the colorSpeed value from Game Data Data.TryGetFloat("colorSpeed", out colorSpeed); // Pull out the colors list from Game Data Data.TryGetColorList("colors", out colors); if (colors != null && colors.Count > 0) { renderer.material.color = colors[0]; } } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(lockedKey, out _locked); dict.TryGetInt(HashcodeKey, out _Hashcode); dict.TryGetInt(posInOwnerKey, out _posInOwner); dict.TryGetInt(qualityKey, out _quality); dict.TryGetInt(starKey, out _star); dict.TryGetInt(levelKey, out _level); dict.TryGetFloat(initalQualityKey, out _initalQuality); dict.TryGetString(idKey, out _id); dict.TryGetString(ownerIdKey, out _ownerId); string customDataKey; dict.TryGetString(attitubeKey, out customDataKey); _attitube = new GDEgoddessAttiData(customDataKey); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(bool_fieldKey, out _bool_field); dict.TryGetInt(int_fieldKey, out _int_field); dict.TryGetFloat(float_fieldKey, out _float_field); dict.TryGetString(string_fieldKey, out _string_field); dict.TryGetVector2(vector2_fieldKey, out _vector2_field); dict.TryGetVector3(vector3_fieldKey, out _vector3_field); dict.TryGetVector4(vector4_fieldKey, out _vector4_field); dict.TryGetColor(color_fieldKey, out _color_field); string customDataKey; dict.TryGetString(custom_fieldKey, out customDataKey); _custom_field = new GDESetCustomData(customDataKey); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(bool_fieldKey, out _bool_field); dict.TryGetInt(int_fieldKey, out _int_field); dict.TryGetFloat(float_fieldKey, out _float_field); dict.TryGetString(string_fieldKey, out _string_field); dict.TryGetVector2(vector2_fieldKey, out _vector2_field); dict.TryGetVector3(vector3_fieldKey, out _vector3_field); dict.TryGetVector4(vector4_fieldKey, out _vector4_field); dict.TryGetColor(color_fieldKey, out _color_field); string customDataKey; dict.TryGetString(custom_fieldKey, out customDataKey); _custom_field = new GDEReadSceneUnityTypesData(customDataKey); dict.TryGetBoolList(bool_list_fieldKey, out bool_list_field); dict.TryGetIntList(int_list_fieldKey, out int_list_field); dict.TryGetFloatList(float_list_fieldKey, out float_list_field); dict.TryGetStringList(string_list_fieldKey, out string_list_field); dict.TryGetVector2List(vector2_list_fieldKey, out vector2_list_field); dict.TryGetVector3List(vector3_list_fieldKey, out vector3_list_field); dict.TryGetVector4List(vector4_list_fieldKey, out vector4_list_field); dict.TryGetColorList(color_list_fieldKey, out color_list_field); LoadFromSavedData(dataKey); } }
protected virtual void DrawColor(string fieldName, Dictionary <string, object> data, string label) { try { Color newValue; Color currentValue = Color.white; object temp; Dictionary <string, object> colorDict = data; if (data.TryGetValue(fieldName, out temp)) { colorDict = temp as Dictionary <string, object>; colorDict.TryGetFloat("r", out currentValue.r); colorDict.TryGetFloat("g", out currentValue.g); colorDict.TryGetFloat("b", out currentValue.b); colorDict.TryGetFloat("a", out currentValue.a); } GUIContent content = new GUIContent(label); Vector2 size = labelStyle.CalcSize(content); GUI.Label(new Rect(currentLinePosition, TopOfLine(), size.x, StandardHeight()), content); currentLinePosition += (size.x + 2); float width = 230 - size.x; newValue = EditorGUI.ColorField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), currentValue); currentLinePosition += (width + 2); if (newValue != currentValue) { colorDict.TryAddOrUpdateValue("r", newValue.r); colorDict.TryAddOrUpdateValue("g", newValue.g); colorDict.TryAddOrUpdateValue("b", newValue.b); colorDict.TryAddOrUpdateValue("a", newValue.a); SetNeedToSave(true); } } catch (Exception ex) { // Don't log ExitGUIException here. This is a unity bug with ObjectField and ColorField. if (!(ex is ExitGUIException)) { Debug.LogError(ex); } } }
public override void ParseJson(object jd) { Dictionary <string, object> item = (Dictionary <string, object>)jd; released = item.TryGetInt("released"); if (released == 1) { skinId = item.TryGetLong("skin_id"); grade = item.TryGetString("grade"); commodity_id = item.TryGetInt("commodity_id"); skin_cardId = item.TryGetLong("skin_card"); heroId = item.TryGetLong("hero_id"); skinName = item.TryGetString("name"); iconAtlas = item.TryGetString("icon_atlas"); head_icon_atlas = item.TryGetString("head_icon_atlas"); skinCard = item.TryGetString("original_painting"); modelId = item.TryGetInt("model"); modelNode = FSDataNodeTable <ModelNode> .GetSingleton().FindDataByType(modelId); path = item.TryGetString("path"); deathSound = item.TryGetString("death_sound"); if (item.ContainsKey("hit_sound")) { hitSound = item["hit_sound"].ToString(); } if (item.ContainsKey("dlgAmount")) { dlgAmount = item.TryGetInt("dlgAmount"); } if (item.ContainsKey("icon_name")) { iconName = item["icon_name"].ToString(); } if (item.ContainsKey("type")) { type = item.TryGetInt("type"); } if (item.ContainsKey("property")) { property = item.TryGetFloat("property"); } if (item.ContainsKey("price")) { price = item["price"] as int[]; } if (item.ContainsKey("effectName")) { effectName = item["effectName"] == null ? null : item["effectName"].ToString(); } } }
protected virtual void DrawListColor(int index, Dictionary <string, object> value, List <object> colorList) { try { Color newValue; Color currentValue = Color.white; value.TryGetFloat("r", out currentValue.r); value.TryGetFloat("g", out currentValue.g); value.TryGetFloat("b", out currentValue.b); value.TryGetFloat("a", out currentValue.a); GUIContent content = new GUIContent(string.Format("{0}:", index)); Vector2 size = labelStyle.CalcSize(content); EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), size.x, StandardHeight()), content); currentLinePosition += (size.x + 2); float width = 230 - size.x; newValue = EditorGUI.ColorField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), currentValue); currentLinePosition += (width + 2); if (newValue != currentValue) { value.TryAddOrUpdateValue("r", newValue.r); value.TryAddOrUpdateValue("g", newValue.g); value.TryAddOrUpdateValue("b", newValue.b); value.TryAddOrUpdateValue("a", newValue.a); colorList[index] = value; SetNeedToSave(true); } } catch (Exception ex) { // Don't log ExitGUIException here. This is a unity bug with ObjectField and ColorField. if (!(ex is ExitGUIException)) { Debug.LogException(ex); } } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(hideHairKey, out _hideHair); dict.TryGetInt(requireWeightKey, out _requireWeight); dict.TryGetInt(healthPointKey, out _healthPoint); dict.TryGetInt(atkBonusKey, out _atkBonus); dict.TryGetInt(defBonusKey, out _defBonus); dict.TryGetInt(dmgClampMinKey, out _dmgClampMin); dict.TryGetInt(dmgClampMaxKey, out _dmgClampMax); dict.TryGetInt(dmgCountKey, out _dmgCount); dict.TryGetFloat(populationKey, out _population); dict.TryGetFloat(speedBonusKey, out _speedBonus); dict.TryGetFloat(visionRangeKey, out _visionRange); dict.TryGetFloat(atkRangeKey, out _atkRange); dict.TryGetFloat(atkSpeedKey, out _atkSpeed); dict.TryGetFloat(weightRobRateKey, out _weightRobRate); dict.TryGetString(nickNameKey, out _nickName); dict.TryGetString(raceNameKey, out _raceName); dict.TryGetString(ownerNameKey, out _ownerName); dict.TryGetString(shapePathKey, out _shapePath); dict.TryGetString(leftWeaponDataKey, out _leftWeaponData); dict.TryGetString(rightWeaponDataKey, out _rightWeaponData); dict.TryGetString(animPathKey, out _animPath); dict.TryGetString(fsmPathKey, out _fsmPath); LoadFromSavedData(dataKey); } }
/// <summary> /// Reads the value for Key and converts it to a List<Vector4> /// </summary> /// <returns><c>true</c>, if the value was successfully converted, <c>false</c> otherwise.</returns> /// <param name="key">Key.</param> /// <param name="value">Converted value</param> public static bool TryGetVector4List <TKey, TValue>(this Dictionary <TKey, TValue> variable, TKey key, out List <Vector4> value) { bool result = true; value = null; try { List <object> tempList; if (variable.TryGetList(key, out tempList)) { Vector4 vect; value = new List <Vector4>(); foreach (object vec4 in tempList) { Dictionary <string, object> vectDict = vec4 as Dictionary <string, object>; vect = new Vector4(); if (vectDict != null) { vectDict.TryGetFloat("x", out vect.x); vectDict.TryGetFloat("y", out vect.y); vectDict.TryGetFloat("z", out vect.z); vectDict.TryGetFloat("w", out vect.w); } value.Add(vect); } } } catch { result = false; } return(result); }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetFloat(HealthPointsKey, out _HealthPoints); dict.TryGetFloat(BasicMeleeLowKey, out _BasicMeleeLow); dict.TryGetFloat(BasicDistanceLowKey, out _BasicDistanceLow); dict.TryGetFloat(BasicMagicLowKey, out _BasicMagicLow); dict.TryGetFloat(SpecialAbilityAdditiveKey, out _SpecialAbilityAdditive); dict.TryGetString(MonsterNameKey, out _MonsterName); dict.TryGetString(MonsterTypeKey, out _MonsterType); dict.TryGetString(MonsterDescriptionKey, out _MonsterDescription); dict.TryGetString(DifficultyLevelKey, out _DifficultyLevel); dict.TryGetString(SpecialAbilityKey, out _SpecialAbility); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetInt(IDKey, out _ID); dict.TryGetInt(MaxHPKey, out _MaxHP); dict.TryGetInt(MaxShieldValKey, out _MaxShieldVal); dict.TryGetInt(ShieldRestoreVecKey, out _ShieldRestoreVec); dict.TryGetFloat(MoveVecKey, out _MoveVec); dict.TryGetFloat(HurtProtectKey, out _HurtProtect); dict.TryGetFloat(MassKey, out _Mass); dict.TryGetFloat(ShieldRestoreIntervalKey, out _ShieldRestoreInterval); dict.TryGetFloat(ShieldRestoreBreakKey, out _ShieldRestoreBreak); dict.TryGetString(PrefabPathKey, out _PrefabPath); LoadFromSavedData(dataKey); } }
/// <summary> /// Reads the value for Key and converts it to a List<Color> /// </summary> /// <returns><c>true</c>, if the value was successfully converted, <c>false</c> otherwise.</returns> /// <param name="key">Key.</param> /// <param name="value">Converted value</param> public static bool TryGetColorList <TKey, TValue>(this Dictionary <TKey, TValue> variable, TKey key, out List <Color> value) { bool result = true; value = null; try { List <object> tempList; if (variable.TryGetList(key, out tempList)) { Color col; value = new List <Color>(); foreach (object color in tempList) { Dictionary <string, object> colorDict = color as Dictionary <string, object>; col = new Color(); if (colorDict != null) { colorDict.TryGetFloat("r", out col.r); colorDict.TryGetFloat("g", out col.g); colorDict.TryGetFloat("b", out col.b); colorDict.TryGetFloat("a", out col.a); } value.Add(col); } } } catch { result = false; } return(result); }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetInt(spawnCountKey, out _spawnCount); dict.TryGetFloat(weightKey, out _weight); dict.TryGetString(typeNameKey, out _typeName); dict.TryGetString(nickNameKey, out _nickName); dict.TryGetString(spawnLevelKey, out _spawnLevel); dict.TryGetString(shapePathKey, out _shapePath); LoadFromSavedData(dataKey); } }
public override void ParseJson(object jd) { Dictionary <string, object> item = (Dictionary <string, object>)jd; id = int.Parse(item["id"].ToString()); // modelName = item["remarks"].ToString(); respath = item["respath"].ToString(); modelRoot = respath.Substring(0, respath.LastIndexOf("/") + 1); modelPath = respath.Substring(respath.LastIndexOf("/") + 1); modelLowPath = modelPath + "_low"; navRadius = float.Parse(item["navSize"].ToString()); colliderRadius = float.Parse(item["colliderSize"].ToString()); // if (item.ContainsKey("size")) // { // modelSize = float.Parse(item["size"].ToString()); // } modelDataType = item.TryGetIntArr("ModelDataType"); showSize = item.TryGetFloat("showSize", 0); object[] temObj; if (item.ContainsKey("colliderCenter")) { temObj = (object[])item["colliderCenter"]; if (temObj != null && temObj.Length >= 2) { colliderCenterY = float.Parse(temObj[1].ToString()); } } // if (item.ContainsKey("modelrotation")) // { // modelRotation = float.Parse(item["modelrotation"].ToString()); // } if (item.ContainsKey("colliderHeight")) { colliderHeight = float.Parse(item["colliderHeight"].ToString()); } if (item.ContainsKey("modelPosition_dialogue")) { modelPosY = float.Parse(item["modelPosition_dialogue"].ToString()); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(FirstCardKey, out _FirstCard); dict.TryGetBool(FightKey, out _Fight); dict.TryGetFloat(MissionLevelKey, out _MissionLevel); dict.TryGetString(MissionNameKey, out _MissionName); dict.TryGetString(MissionDescriptionKey, out _MissionDescription); dict.TryGetString(NextCardKey, out _NextCard); dict.TryGetString(AnswerAKey, out _AnswerA); dict.TryGetString(AnswerBKey, out _AnswerB); dict.TryGetString(AnswerCKey, out _AnswerC); dict.TryGetString(AnswerDKey, out _AnswerD); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(NotNormalPoolKey, out _NotNormalPool); dict.TryGetBool(UnableKey, out _Unable); dict.TryGetInt(AltarTimesKey, out _AltarTimes); dict.TryGetInt(PoolCapacityKey, out _PoolCapacity); dict.TryGetInt(GetSNumKey, out _GetSNum); dict.TryGetFloat(lasttimeKey, out _lasttime); dict.TryGetString(NameKey, out _Name); dict.TryGetString(IDKey, out _ID); dict.TryGetString(starttimeKey, out _starttime); dict.TryGetStringList(AllHeroesKey, out AllHeroes); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(lockedKey, out _locked); dict.TryGetInt(equipTypeKey, out _equipType); dict.TryGetInt(equipBattleForceKey, out _equipBattleForce); dict.TryGetInt(indexKey, out _index); dict.TryGetInt(numKey, out _num); dict.TryGetInt(hashcodeKey, out _hashcode); dict.TryGetInt(OwnerHashcodeKey, out _OwnerHashcode); dict.TryGetInt(lvKey, out _lv); dict.TryGetInt(qualityKey, out _quality); dict.TryGetFloat(initialQualityKey, out _initialQuality); dict.TryGetString(idKey, out _id); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetInt(IDKey, out _ID); dict.TryGetInt(MaxHPKey, out _MaxHP); dict.TryGetFloat(MoveVecKey, out _MoveVec); dict.TryGetFloat(AlertRangeKey, out _AlertRange); dict.TryGetFloat(AtkRangeKey, out _AtkRange); dict.TryGetFloat(AtkIntervalKey, out _AtkInterval); dict.TryGetFloat(HurtProtectKey, out _HurtProtect); dict.TryGetFloat(MassKey, out _Mass); dict.TryGetString(PrefabPathKey, out _PrefabPath); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetFloat(HealthPointsKey, out _HealthPoints); dict.TryGetFloat(ExperienceKey, out _Experience); dict.TryGetFloat(LevelKey, out _Level); dict.TryGetFloat(BasicMeleeKey, out _BasicMelee); dict.TryGetFloat(BasicDistanceKey, out _BasicDistance); dict.TryGetFloat(BasicMagicKey, out _BasicMagic); dict.TryGetString(CharacterNameKey, out _CharacterName); dict.TryGetString(CharacterDescriptionKey, out _CharacterDescription); dict.TryGetString(DifficultyLevelKey, out _DifficultyLevel); LoadFromSavedData(dataKey); } }
public List <double[]> newbul_angle = new List <double[]>(); //子弹弹道角度偏移 public override void ParseJson(object jd) { Dictionary <string, object> item = (Dictionary <string, object>)jd; id = item.TryGetInt("ID"); fly_speed = item.TryGetFloat("fly_speed"); fly_max = item.TryGetFloat("fly_max"); effect = item.TryGetString("effect"); //if (item.ContainsKey("effect_xyz") && item["effect_xyz"] != null) //{ // object[] effect_xyz_temp = item["effect_xyz"] as object[]; // GetVector3List(effect_xyz, effect_xyz_temp); //} effect_xyz = item.TryGetToVector3("effect_xyz"); aerobatics = item.TryGetInt("aerobatics"); target_type = item.TryGetInt("target_type"); time_max = item.TryGetFloat("time_max"); effect_timeend = item.TryGetFloat("effect_timeend"); follow_type = item.TryGetInt("follow_type"); col_type = item.TryGetIntArr("col_type"); pen_times_max = item.TryGetIntArr("pen_times_max"); col_times_single = item.TryGetInt("col_times_single"); pen_times_singe = item.TryGetInt("pen_times_singe"); col_times_space = item.TryGetIntArr("col_times_space"); col_times_max = item.TryGetInt("col_times_max"); col_times_oneupdate = item.TryGetInt("col_times_oneupdate"); col_size_type = item.TryGetInt("col_size_type"); col_size_value = item.TryGetDoubleArr("col_size_value"); col_size_change = item.TryGetDoubleArr("col_size_change"); col_size_changespeed = item.TryGetFloat("col_size_changespeed"); effect_hit = item.TryGetString("effect_hit"); effect_hit_position = item.TryGetInt("effect_hit_position"); effect_hit_positionxyz = item.TryGetToVector3("effect_hit_positionxyz"); damage = item.TryGetFloat("damage"); dmg_origin = item.TryGetInt("dmg_origin"); buff = item.TryGetIntArr("buff"); buff_value = item.TryGetIntArr("buff_value"); buff_odds = item.TryGetFloat("buff_odds"); new_unit = item.TryGetIntArr("new_unit"); unit_num = item.TryGetIntArr("unit_num"); unit_range = item.TryGetDoubleArr("unit_range"); if (item.ContainsKey("newbul") && item["newbul"] != null) { object[] newbul_temp = item["newbul"] as object[]; GetIntList(newbul, newbul_temp); } if (item.ContainsKey("newbul_dalay") && item["newbul_dalay"] != null) { object[] newbul_dalay_temp = item["newbul_dalay"] as object[]; GetDoubleList(newbul_dalay, newbul_dalay_temp); } if (item.ContainsKey("newbul_origin") && item["newbul_origin"] != null) { object[] newbul_origin_temp = item["newbul_origin"] as object[]; GetIntList(newbul_origin, newbul_origin_temp); } if (item.ContainsKey("newbul_target_type") && item["newbul_target_type"] != null) { object[] newbul_target_type_temp = item["newbul_target_type"] as object[]; GetIntList(newbul_target_type, newbul_target_type_temp); } if (item.ContainsKey("newbul_target_value") && item["newbul_target_value"] != null) { object[] newbul_target_value_temp = item["newbul_target_value"] as object[]; GetIntList(newbul_target_value, newbul_target_value_temp); } if (item.ContainsKey("newbul_target_size") && item["newbul_target_size"] != null) { object[] newbul_target_size_temp = item["newbul_target_size"] as object[]; GetDoubleList(newbul_target_size, newbul_target_size_temp); } if (item.ContainsKey("newbul_target_extra") && item["newbul_target_extra"] != null) { object[] newbul_target_extra_temp = item["newbul_target_extra"] as object[]; GetIntList(newbul_target_extra, newbul_target_extra_temp); } if (item.ContainsKey("newbul_max") && item["newbul_max"] != null) { object[] newbul_max_temp = item["newbul_max"] as object[]; GetIntList(newbul_max, newbul_max_temp); } if (item.ContainsKey("newbul_num_single") && item["newbul_num_single"] != null) { newbul_num_single = new List <int[]>(); object[] newbul_num_single_temp = item["newbul_num_single"] as object[]; for (int i = 0; i < newbul_num_single_temp.Length; i++) { int[] objs = newbul_num_single_temp[i] as int[]; newbul_num_single.Add(objs); } } if (item.ContainsKey("newbul_firing") && item["newbul_firing"] != null) { object[] newbul_firing_temp = item["newbul_firing"] as object[]; GetIntList(newbul_firing, newbul_firing_temp); } if (item.ContainsKey("newbul_firing_xyz") && item["newbul_firing_xyz"] != null) { object[] newbul_firing_xyz_temp = item["newbul_firing_xyz"] as object[]; GetVector3List(newbul_firing_xyz, newbul_firing_xyz_temp); } if (item.ContainsKey("newbul_end") && item["newbul_end"] != null) { object[] newbul_end_temp = item["newbul_end"] as object[]; GetIntList(newbul_end, newbul_end_temp); } if (item.ContainsKey("newbul_end_xyz") && item["newbul_end_xyz"] != null) { object[] newbul_end_xyz_temp = item["newbul_end_xyz"] as object[]; GetVector3List(newbul_end_xyz, newbul_end_xyz_temp); } if (item.ContainsKey("newbul_angle") && item["newbul_angle"] != null) { object[] newbul_angle_temp = item["newbul_angle"] as object[]; GetDoubleList(newbul_angle, newbul_angle_temp); } }
protected virtual void DrawListColor(int index, Dictionary<string, object> value, List<object> colorList) { try { Color newValue; Color currentValue = Color.white; value.TryGetFloat("r", out currentValue.r); value.TryGetFloat("g", out currentValue.g); value.TryGetFloat("b", out currentValue.b); value.TryGetFloat("a", out currentValue.a); GUIContent content = new GUIContent(string.Format("{0}:", index)); Vector2 size = labelStyle.CalcSize(content); EditorGUI.LabelField(new Rect(currentLinePosition, TopOfLine(), size.x, StandardHeight()), content); currentLinePosition += (size.x + 2); float width = 230 - size.x; newValue = EditorGUI.ColorField(new Rect(currentLinePosition, TopOfLine(), width, StandardHeight()), currentValue); currentLinePosition += (width + 2); if (newValue != currentValue) { value.TryAddOrUpdateValue("r", newValue.r); value.TryAddOrUpdateValue("g", newValue.g); value.TryAddOrUpdateValue("b", newValue.b); value.TryAddOrUpdateValue("a", newValue.a); colorList[index] = value; SetNeedToSave(true); } } catch (Exception ex) { // Don't log ExitGUIException here. This is a unity bug with ObjectField and ColorField. if (!(ex is ExitGUIException)) Debug.LogException(ex); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetFloat(localScaleKey, out _localScale); dict.TryGetFloat(aggroKey, out _aggro); dict.TryGetFloat(counterKey, out _counter); dict.TryGetFloat(reflectKey, out _reflect); dict.TryGetFloat(stunKey, out _stun); dict.TryGetFloat(criticalKey, out _critical); dict.TryGetFloat(poisonKey, out _poison); dict.TryGetFloat(bleedKey, out _bleed); dict.TryGetFloat(slowKey, out _slow); dict.TryGetFloat(pierceKey, out _pierce); dict.TryGetFloat(flameKey, out _flame); dict.TryGetString(weaponNameKey, out _weaponName); dict.TryGetString(typeNameKey, out _typeName); dict.TryGetString(raceNameKey, out _raceName); dict.TryGetString(shapePathKey, out _shapePath); string customDataKey; dict.TryGetString(projectileKeyKey, out customDataKey); _projectileKey = new GDEProjectileData(customDataKey); dict.TryGetString(extraProjectileKeyKey, out customDataKey); _extraProjectileKey = new GDEProjectileData(customDataKey); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary<string, object> dict) { _key = dataKey; if (dict == null) LoadFromSavedData(dataKey); else { dict.TryGetBool(bool_fieldKey, out _bool_field); dict.TryGetInt(int_fieldKey, out _int_field); dict.TryGetFloat(float_fieldKey, out _float_field); dict.TryGetString(string_fieldKey, out _string_field); dict.TryGetVector2(vector2_fieldKey, out _vector2_field); dict.TryGetVector3(vector3_fieldKey, out _vector3_field); dict.TryGetVector4(vector4_fieldKey, out _vector4_field); dict.TryGetColor(color_fieldKey, out _color_field); string customDataKey; dict.TryGetString(custom_fieldKey, out customDataKey); GDEDataManager.DataDictionary.TryGetCustom(customDataKey, out _custom_field); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary<string, object> dict) { _key = dataKey; if (dict == null) LoadFromSavedData(dataKey); else { dict.TryGetBool(stage_lockKey, out _stage_lock); dict.TryGetInt(base_scoreKey, out _base_score); dict.TryGetInt(high_scoreKey, out _high_score); dict.TryGetFloat(remain_fuelKey, out _remain_fuel); dict.TryGetFloat(base_fuelKey, out _base_fuel); dict.TryGetGameObject(game_objectKey, out _game_object); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary<string, object> dict) { _key = dataKey; if (dict == null) LoadFromSavedData(dataKey); else { dict.TryGetBool(bool_fieldKey, out _bool_field); dict.TryGetInt(int_fieldKey, out _int_field); dict.TryGetFloat(float_fieldKey, out _float_field); dict.TryGetString(descriptionKey, out _description); dict.TryGetString(string_fieldKey, out _string_field); dict.TryGetVector2(vector2_fieldKey, out _vector2_field); dict.TryGetVector3(vector3_fieldKey, out _vector3_field); dict.TryGetColor(color_fieldKey, out _color_field); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary<string, object> dict) { _key = dataKey; if (dict == null) LoadFromSavedData(dataKey); else { dict.TryGetInt(projectileRangeKey, out _projectileRange); dict.TryGetInt(numberOfUsesKey, out _numberOfUses); dict.TryGetInt(CostOfUseKey, out _CostOfUse); dict.TryGetFloat(itemDurationKey, out _itemDuration); dict.TryGetString(itemTypeKey, out _itemType); dict.TryGetGameObject(ItemModelKey, out _ItemModel); LoadFromSavedData(dataKey); } }
public override void LoadFromDict(string dataKey, Dictionary <string, object> dict) { _key = dataKey; if (dict == null) { LoadFromSavedData(dataKey); } else { dict.TryGetBool(isObstacleKey, out _isObstacle); dict.TryGetBool(scaleByWeightKey, out _scaleByWeight); dict.TryGetInt(spawnHeightKey, out _spawnHeight); dict.TryGetInt(healthPointKey, out _healthPoint); dict.TryGetInt(atkBonusKey, out _atkBonus); dict.TryGetInt(defBonusKey, out _defBonus); dict.TryGetInt(dmgClampMinKey, out _dmgClampMin); dict.TryGetInt(dmgClampMaxKey, out _dmgClampMax); dict.TryGetInt(dmgCountKey, out _dmgCount); dict.TryGetFloat(weightKey, out _weight); dict.TryGetFloat(speedBonusKey, out _speedBonus); dict.TryGetFloat(visionRangeKey, out _visionRange); dict.TryGetFloat(atkRangeKey, out _atkRange); dict.TryGetFloat(atkSpeedKey, out _atkSpeed); dict.TryGetFloat(weightRobRateKey, out _weightRobRate); dict.TryGetFloat(aggroKey, out _aggro); dict.TryGetFloat(counterKey, out _counter); dict.TryGetFloat(reflectKey, out _reflect); dict.TryGetFloat(stunKey, out _stun); dict.TryGetFloat(criticalKey, out _critical); dict.TryGetFloat(poisonKey, out _poison); dict.TryGetFloat(bleedKey, out _bleed); dict.TryGetFloat(slowKey, out _slow); dict.TryGetFloat(pierceKey, out _pierce); dict.TryGetFloat(flameKey, out _flame); dict.TryGetString(typeNameKey, out _typeName); dict.TryGetString(nickNameKey, out _nickName); dict.TryGetString(spawnLevelKey, out _spawnLevel); dict.TryGetString(shapePathKey, out _shapePath); dict.TryGetString(animPathKey, out _animPath); dict.TryGetString(fsmPathKey, out _fsmPath); dict.TryGetVector3(localScaleKey, out _localScale); LoadFromSavedData(dataKey); } }
public int[] combo_time; //普攻连击限制 //-------------------------------------------------------------------------------------- public override void ParseJson(object jd) { Dictionary <string, object> item = (Dictionary <string, object>)jd; skill_id = item.TryGetLong("skillid"); name = item.TryGetString("name"); hero_id = item.TryGetLong("hero_id"); skill_name = item.TryGetString("skill_name"); des = item.TryGetString("des"); skill_atlas = item.TryGetString("icon_atlas"); skill_icon = item.TryGetString("skill_icon"); spell_motion = item.TryGetString("skill_motion"); sound = item.TryGetString("sound"); hit_sound = item.TryGetString("hit_sound"); target_ceiling = item.TryGetByte("target_ceiling"); attack_type = item.TryGetByte("attack_type"); types = item.TryGetByte("types"); dist = item.TryGetFloat("dist"); castBefore = item.TryGetFloat("end_motion"); if (item.ContainsKey("singular_aoe")) { isSingle = item["singular_aoe"] == null ? true : byte.Parse(item["singular_aoe"].ToString()) == 0; } if (item.ContainsKey("ignore_terrain")) { ignoreTerrain = item["ignore_terrain"] == null ? false : byte.Parse(item["ignore_terrain"].ToString()) == 0; } if (item.ContainsKey("pierce through")) { isPierce = item["pierce through"] == null ? false : byte.Parse(item["pierce through"].ToString()) == 0; } flight_speed = item.TryGetFloat("flight_speed"); if (item.ContainsKey("max_fly")) { max_fly = item["max_fly"] == null ? 0 : float.Parse(item["max_fly"].ToString()); } skill_type = item.ContainsKey("skill_type") && item["skill_type"] != null ? (SkillCastType)byte.Parse(item["skill_type"].ToString()) : (SkillCastType)0; if (item.ContainsKey("range_type")) { range_type = (rangeType)byte.Parse(item["range_type"].ToString()); } aoe_long = item.TryGetFloat("aoe_long"); aoe_wide = item.TryGetFloat("aoe_wide"); angle = item.TryGetFloat("angle"); site = item.TryGetInt("site"); seat = item.TryGetInt("seat"); alertedType = item.TryGetInt("alerted_type"); length_base = item.TryGetFloat("length_base"); energy = item.TryGetInt("energy"); if (item.ContainsKey("choose_target")) { choseTarget = (ChoseTarget)(int.Parse(item["choose_target"].ToString())); } if (item.ContainsKey("rangen_type")) { object[] rangens = item["rangen_type"] as object[]; if (rangens != null) { rangenValue.type = rangens.Length > 0 ? (RangenType)(int.Parse(rangens[0].ToString())) : RangenType.OuterCircle; switch (rangenValue.type) { case RangenType.OuterCircle: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; break; case RangenType.OuterCircle_InnerCube: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.length = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; rangenValue.width = rangens.Length > 3 ? float.Parse(rangens[3].ToString()) : 0; break; case RangenType.OuterCircle_InnerSector: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.angle = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; break; case RangenType.OuterCircle_InnerCircle: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.innerRadius = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; break; case RangenType.InnerCube: rangenValue.length = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.width = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; break; default: break; } } } if (item.ContainsKey("interval_time")) { interval_time = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["interval_time"]); } if (item.ContainsKey("damage_ratio")) { damage_ratio = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["damage_ratio"]); } if (item.ContainsKey("nullity_type")) { int[] nodelist = item["nullity_type"] as int[]; if (nodelist != null) { nullity_type = new int[nodelist.Length]; for (int m = 0; m < nodelist.Length; m++) { nullity_type[m] = nodelist[m]; } } } if (item.ContainsKey("influence_type")) { int[] influenceList = item["influence_type"] as int[]; if (influenceList != null) { influence_type = influenceList; } } missable = item.TryGetByte("missable"); efficiency_time = item.TryGetFloat("efficiency_time"); effect_time = item.TryGetFloat("effect_time"); cooling = item.TryGetFloat("cooling"); if (item.ContainsKey("base_num1")) { base_num1 = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["base_num1"]); } if (item.ContainsKey("growth_ratio1")) { growth_ratio1 = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["growth_ratio1"]); } if (item.ContainsKey("skill_ratio")) { skill_ratio = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["skill_ratio"]); if (skill_ratio == null) { GameDebug.LogError("skill_ratio null"); } } if (item.ContainsKey("stats")) { stats = item["stats"] as int[]; } if (item.ContainsKey("buffs_target")) { buffs_target = item["buffs_target"] as int[]; } if (item.ContainsKey("special_buffs")) { specialBuffs = (object[])item["special_buffs"]; } if (item.ContainsKey("skill_parts")) { skill_parts = FSDataNodeTable <SkillNode> .GetSingleton().ParseToLongArray(item["skill_parts"]); } if (item.ContainsKey("add_state")) { add_state = item["add_state"] as object[]; } range = item.TryGetFloat("dist"); warn_time = item.TryGetFloat("warn_time"); // nullity_type = byte.Parse(item["nullity_type"].ToString()); animatorTime = item.TryGetFloat("actuation time"); if (item.ContainsKey("life_drain")) { life_drain = item["life_drain"] as object[]; } if (item.ContainsKey("alerted_position")) { alerted_position = item.TryGetInt("alerted_position"); } //-------------------------------------------------------------------------------------- //新加数据 energyvalue = item.TryGetInt("energy_value"); can_move = item.TryGetInt("can_move") == 2; is_turnround = item.TryGetInt("is_turnround") == 1; face_type = (FaceType)item.TryGetInt("face_type"); effect = item.TryGetStringIntArr("effect"); effect_position = item.TryGetIntArr("effect_position"); if (item.ContainsKey("effect_positionxyz") && item["effect_positionxyz"] != null) { object[] effect_positionxyz_temp = item["effect_positionxyz"] as object[]; GetVector3List(effect_positionxyz, effect_positionxyz_temp); } effect_start = item.TryGetDoubleArr("effect_start"); effect_end = item.TryGetDoubleArr("effect_end"); skill_usetype = (SkillUseType)item.TryGetInt("skill_usetype"); bullet_time = item.TryGetDoubleArr("bullet_time"); bullet_id = item.TryGetIntArr("bullet_id"); bul_target_type = item.TryGetIntArr("bul_target_type"); if (item.ContainsKey("bul_target_value") && item["bul_target_value"] != null) { bul_target_value = new List <int[]>(); object[] bul_target_value_temp = item["bul_target_value"] as object[]; for (int i = 0; i < bul_target_value_temp.Length; i++) { int[] objs = bul_target_value_temp[i] as int[]; bul_target_value.Add(objs); } } bul_target_size = item.TryGetIntArr("bul_target_size"); max_bul = item.TryGetIntArr("max_bul"); if (item.ContainsKey("bul_num_single") && item["bul_num_single"] != null) { bul_num_single = new List <int[]>(); object[] bul_num_single_temp = item["bul_num_single"] as object[]; for (int i = 0; i < bul_num_single_temp.Length; i++) { int[] objs = bul_num_single_temp[i] as int[]; bul_num_single.Add(objs); } } bul_start = item.TryGetIntArr("bul_start"); isFiringPoint = item.TryGetInt("firing"); if (item.ContainsKey("firing_xyz") && item["firing_xyz"] != null) { object[] firing_xyz_temp = item["firing_xyz"] as object[]; GetVector3List(firing_xyz, firing_xyz_temp); } bul_end = item.TryGetInt("bul_end"); if (item.ContainsKey("bul_end_xyz") && item["bul_end_xyz"] != null) { object[] bul_end_xyz_temp = item["bul_end_xyz"] as object[]; GetVector3List(bul_end_xyz, bul_end_xyz_temp); } bul_end_angle = item.TryGetIntArr("bul_end_angle"); bul_son_max = item.TryGetIntArr("bul_son_max"); combo_time = item.TryGetIntArr("combo_time"); //-------------------------------------------------------------------------------------- }