public override bool OnMessage(UIMessage msg) { switch (msg.type) { case UIMsgType.GameAreaStateChange: RefreshAreaState(); return(true); case UIMsgType.MainShip_Area_EnergyLoad_Change: UpdateEnergyLoad(); return(true); case UIMsgType.MainShip_Area_PowerLevel_Change: return(UpdateAreaEnergyCost((MainShipAreaType)msg.content[0])); case UIMsgType.MenuPage_Update_BuildPanel: FunctionBlockTypeData typeData = (FunctionBlockTypeData)msg.content[0]; var type = FunctionBlockModule.GetBlockType(typeData); return(RefreshBuildMainPanel(type)); case UIMsgType.UpdateTime: return(UpdateTimePanel()); default: return(false); } }
public override void Construction() { AllFunctionBlockList = new List <FunctionBlock>(); for (int i = 0; i < 2; i++) { FunctionBlock fac = new FunctionBlock(); fac.FunctionBlockID = i; fac.BlockName = ""; fac.BlockBG = ""; fac.BlockIcon = ""; fac.BlockDesc = ""; fac.PreLevelBlock = i; fac.FunctionBlockType = ""; AllFunctionBlockList.Add(fac); } AllFunctionBlockTypeDataList = new List <FunctionBlockTypeData>(); for (int i = 0; i < 2; i++) { FunctionBlockTypeData type = new FunctionBlockTypeData(); type.Type = ""; type.DefaultShow = true; type.TypeName = ""; type.TypeDesc = ""; type.TypeIcon = ""; AllFunctionBlockTypeDataList.Add(type); } }
public static FunctionBlockType GetBlockType(FunctionBlockTypeData data) { FunctionBlockType result = FunctionBlockType.None; Enum.TryParse <FunctionBlockType>(data.Type, out result); return(result); }
public void InitMainTabElement(FunctionBlockTypeData data) { typedata = data; Icon.sprite = FunctionBlockModule.GetMainTypeSprite(data); toggle.onValueChanged.AddListener((bool isOn) => { OnTabClick(isOn); }); }
//Get Type Data public static FunctionBlockTypeData GetFacotryTypeData(FunctionBlockType type) { FunctionBlockTypeData typeData = null; FunctionBlockTypeDataDic.TryGetValue(type.ToString(), out typeData); if (typeData != null) { return(typeData); } else { Debug.LogError("GetFunctionBlockType Error Type= " + type); return(null); } }
public static string GetMainTypeName(FunctionBlockTypeData data) { return(MultiLanguage.Instance.GetTextValue(data.TypeName)); }
public static Sprite GetMainTypeSprite(FunctionBlockTypeData data) { return(Utility.LoadSprite(data.TypeIcon)); }